I have a Person table which has two columns: first_name and last_name. The Person class has two corresponding fields: firstName and lastName. Now I'm using criteria api and trying to create an order by based on these two columns concatenated. Is it possible? Or it can only be achieved by hql?
Here an example for the JBoss hibernate site:
from DomesticCat cat order by cat.name asc, cat.weight desc, cat.birthdate
Or from the same website, for the Criteria api:
List cats = sess.createCriteria(Cat.class)
.add( Restrictions.like("name", "F%")
.addOrder( Order.asc("name") )
.addOrder( Order.desc("age") )
.setMaxResults(50)
.list();
They seem to be quite fond of cats at JBoss.