session.createQuery("from Foo foo where foo.bar='baz' order by rand()") .setMaxResults(1) .uniqueResult();
rjf wrote:
How can I do something like the following, the hibernate way??
select * from foo where bar='baz' order by RAND() LIMIT 0,1;
Of course what I am doing here is selecting a single random row (object)
Thanks, Ron
------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
-- Gavin King JBoss Group +61 410534454 http://hibernate.org
------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel