Hibernate - get the size of a list in a property

Posted by mada on Stack Overflow See other posts from Stack Overflow or by mada
Published on 2010-02-23T10:53:42Z Indexed on 2010/05/02 16:57 UTC
Read the original article Hit count: 228

Filed under:
|
|
|

I have a class A which have a list of B elements.

In my A class i would like to add:

int size;

which will be valued with the number of B elements. So when I would call myA.getSize() I will have it.

Is it possible to map a count query with a single property in the hibernate mapping?

I don't want to load the list that is why i would like to add a size property.

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about java