Is it possible to fetch random values from Hibernate using the Criteria API?
EG:
Session session = sessionFactory.openSession();
Criteria criteria = session.createCriteria(Something.class);
List<Something> somethingList = (List<Something>)criteria.listRandom();
I want to get a number of values from the database not caring which order they're in, and I'd like to have them be random. Apart from just fetching all of the values from the database and slimming them down from there, is there an alternative method of getting random results within a certain Criteria?
|