-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: max function with critria
PostPosted: Mon May 30, 2005 9:49 am 
Newbie

Joined: Fri Mar 18, 2005 1:05 pm
Posts: 8
Location: Delhi
Hibernate 3.0

Hi I want to get the maximum value from a table for colum.
Can i use max function with critria .

If yes how can i use it .

I dont want to use HQL.

If there is any way of getting maximum value using criteria
Pls let me know.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 30, 2005 11:13 am 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Projections.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 30, 2005 12:32 pm 
Newbie

Joined: Mon Feb 09, 2004 11:14 am
Posts: 16
Criteria criteria=session.createCriteria(className);
criteria.setProjection(Projections.max("id")).uniqueResult();
maxId = criteria.list();


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 9:02 am 
Newbie

Joined: Thu Mar 30, 2006 5:35 am
Posts: 2
What if I would like to have the entire object instead of the id? Is it possible to retrieve it within one request using criteria?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.