Random select rows via JPA
Posted
by Ke
on Stack Overflow
See other posts from Stack Overflow
or by Ke
Published on 2010-03-17T00:15:39Z
Indexed on
2010/03/17
0:21 UTC
Read the original article
Hit count: 745
In Mysql,
SELECT id FROM table ORDER BY RANDOM() LIMIT 5
this sql can select 5 random rows. How to do this via JPA Query (Hibernate as provider, Mysql database)?
Thanks.
© Stack Overflow or respective owner