Reputation: 16964
I would like to use HQL to select a random record for a few integration tests.
I've been using SQL Server ORDER BY newid()
, but HQL parsing likes to raise false alarms.
Upvotes: 0
Views: 3103
Reputation: 2184
Hibernate does not provide a database independent way to do this. You have to do it in two queries.
See Get random object from SQL database via Hibernate
Upvotes: 1