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
  • 16,432
  • 7
  • 52
  • 82

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,164
  • 23
  • 37