How to Ordering the results in the Hibernate by R4R Team

We can set as the given code is below. With the help we can do the results using org.hibernate.criterion.Order.

As we given below:

List student = session.createCriteria(Student.class)

    .add("name", "G%")

    .addOrder( Order.asc("name") )

    .addOrder( Order.desc("age") )



List student = session.createCriteria(Studnet.class)

    .add( Property.forName("name").like("G%") )

    .addOrder( Property.forName("name").asc() )

    .addOrder( Property.forName("age").desc() )



Leave a Comment:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!