-->
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.  [ 2 posts ] 
Author Message
 Post subject: hibernate random function
PostPosted: Tue May 22, 2007 3:05 am 
Newbie

Joined: Tue May 22, 2007 2:12 am
Posts: 9
hi all.

i need to retrieve a number of records from my table.
the retrieval has to be in a random order.
i'm aware of RAND() function in SQL.but is there any similar mapping in HQL too.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 22, 2007 6:57 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

SQLQuery q=sess.createSQLQuery("select RAND(1) as f, * from Table1");
q.list();

Amila
(Don't forget to rate)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.