Reputation: 103
I need in a single database hit, 2 lists first matching some condition and the second is a NOT IN the first list.
Upvotes: 0
Views: 59
Reputation: 8838
You can use
List<Object[]> results = sessionFactory.getCurrentSession().createQuery("select count(*), type from Record group by 2").list();
and then process the result list to your data structure.
Upvotes: 1