java - How can I add to Criteria order by condition with to_char function -


i have in hibernate project criteria object , want add order by condition of date field

but want order field dd/mm/yyyy format, , in database field saved in dd/mm/yyyy hh:mm:ss format.

in sql code looks follows:

order to_char(date_field_name, 'dd/mm/yyyy') 

how can add functionality criteria.addorder?

in other words how can write following?

criteria.addorder(to_char(date_field_name, 'dd/mm/yyyy')) 

if error: no field name in table

or maybe knows other solution of order case?

in criteria, after adding parameter contains date (let's call "currentdate") try (for ascendent order):

.addorder(order.asc("currentdate")) 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -