hibernate select count

Solutions on MaxInterview for hibernate select count by the best coders in the world

showing results for - "hibernate select count"
Juan Diego
13 May 2019
1// All entries
2Long count = (Long) session.createQuery("select count(ALL YourTable) from YourTable yourTable").getSingleResult();
3
4// filtered entries
5Long count = (Long) session.createQuery("select count(yourTable) from YourTable yourTable where yourTable.whatever = whatever").setParameter("whatever", yourParam).getSingleResult();