If I have a class called Person as
public class Person{
private int id;
private int age;
}
How can I get the person object with max age?
when I use criteria.setProjection(Projections.max("age) ), it will return me the max age, and then I should find the entry of the person with this age.
Can I skip find the max age? And get the person with max age directly. It may looks like,
person = criteria.somehow.setProjection().somehow.setMaxResults(1).uniqueResult();
I'm trying find out the way to do this, because I concerned if I do twice search in hibernate, it will waste my performance time.