Select random rows in JQPL or JPA
Hello.
I have CardResource entity. And in database created Card_Resource table.
I want to select random 5 rows from this Entity.
I did that
List<CardResource> result;
Query query = entityManager.createQuery("SELECT e FROM CardResource e ORDER BY RAND() ");
result = query.setMaxResults(5).getResultList();
But this gave me exceptions.
Thanks for attention