moonberry
moonberry

Reputation: 103

Is there a possibility to get multiple lists from a hibernate native sql query?

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

Answers (1)

Justinas Jakavonis
Justinas Jakavonis

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

Related Questions