random « MySQL « JPA Q&A





1. Hibernate Criteria API: get n random rows    stackoverflow.com

I can't figure out how to fetch n random rows from a criteria instance:

Criteria criteria = session.createCriteria(Table.class);
criteria.add(Restrictions.eq('fieldVariable', anyValue));
...
Then what? I can't find any doc with Criteria API Does it mean I ...

2. Get random object from SQL database via Hibernate    stackoverflow.com

I have following MySql dependent code ( ORDER BY RAND() ) . I would like to know if there is hibernate HQL alternative for it (admin is boolean tag indicating that ...