Reputation: 37
Suppose we have a class (Staff) with a Set. How can we determine the number of elements in the set, using HQL?
Upvotes: 1
Views: 892
Reputation: 57411
Query query = session.createQuery(
"select count(*) from Stuff s inner join s.set countSet where s.id=:someId");
query.setString("someId", 123);
Long count = (Long)query.uniqueResult();
Something like this. If you post your class HQL could be corrected to reflect your names
Upvotes: 2