Question

Here, i am posting what i need from you!

DetachedCriteria criteria = DetachedCriteria.forEntityName(DomainEntity.tbl_user.toString);
criteria.addOrder(Order.asc("username"));
List<User> user = dao.getEntities(criteria);

This code is working fine, But sorting the names first UpperCase letters then LowerCase letters. I don't want that way.

But, I want both sorting at a time. Based on the alphabetical order. Here, i am using MySQL database.

Was it helpful?

Solution

Are you looking for case-insensitive ordering ? Then try this :

Order.asc("username").ignoreCase()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top