I can't answer for this specific situation, but it's certainly possible
that there is no real reason. It's possible that it was a mistake or
it's possible that it doesn't really matter for this situation and
either will work, i dunno.
I would say that in general I think our Hibernate mappings are not
defined to the best of their abilities, so there definitely may be
situations like this where nobody has an exact reason why it is the way
it is :/
-- Allen
Markus Fuchs wrote:
Hi,
I'm wondering, why some collection fields in the pojo classes are marked
* @hibernate.bag lazy="true" inverse="true" cascade="delete"
and others
* @hibernate.set lazy="true" order-by="name" inverse="true"
cascade="all-delete-orphan"
The two relationships marked as hibernate.bag are
WebSiteData.permissions and UserData.permissions. What special
functionality of the permissions relationships requires the
hibernate.bag annotation? What differentiates hibernate.bag from
hibernate.set? My understanding is that hibernate.set is a special kind
of Set, that can be ordered, etc. hibernate.bag seems to allow
duplicates, is that why it's used for permissions? The application logic
doesn't suggest, that duplicates must be stored. Also, permissions do
have primary keys, and the documentation in
http://anonhibernate.labs.jboss.com/trunk/Hibernate3/src/org/hibernate/mapping/Bag.java
suggests, that the items stored in a Bag don't have ids.
Thanks!
-- markus.