0

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.

John Giotta
  • 15,842
  • 6
  • 46
  • 78

1 Answers1

1

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

Community
  • 1
  • 1
carbontax
  • 2,154
  • 23
  • 36