Just a quick one that I forgot to note down. If you want to count rows using a hibernate query, here is the bit of magic that you need.

return (Number) session.createCriteria(Bananas.class).setProjection(Projections.rowCount()).uniqueResult();

 

Matt Reid

Lead Software Architect. Java/Node enthusiast, badminton lover, foodie.

drei01 Matthew_Reid


Published