[Hibernate] Random object query

2003-11-14 Thread Ron Forrester
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 is sponsor

Re: [Hibernate] Random object query

2003-11-13 Thread Gavin King
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 sin

[Hibernate] Random object query

2003-11-13 Thread rjf
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