Reputation: 4807
I have one criteria and i stuck with following:
I am using sql server so in my sql server I have following condition(Note: I am not putting whole query here I am just putting my order by clause)
order by (IIF(LEN(Code) = 1, '0'+Code ,Code))
"Code" is my column name, Now I want to implement same in hibernate in following
criteria.addOrder(Order.asc("CTC.code"));
Please help me out to achieve this. Any help will be appreciated.
Upvotes: 2
Views: 1810
Reputation: 4807
After spending too much time and googling I found working solution from here:
In that example they have override Order class's method of criteria, I got what i was wanted, really charm for me.
Upvotes: 1