criteria uniqueresult() null projections hibernate
Ran into weird issue with hibernate
criteria.setProjection(Projections.rowCount());
long count = (Long) criteria.uniqueResult();
in above case criteria.uniqueResult() should never return null.
Solution:
This happens when you have multiple sessions factories in the code & they are not wired correctly. Just match them correctly so they don’t interfere with each other. 🙂