On Thursday, January 8, 2015 at 2:46:58 AM UTC-6, Peter Klaesson wrote: > > We have an entity where two instances have to share the same collection. > > Table A (EntityA) > > E1 id1, collectionKey > E2 id2, collectionKey > > Table B > > collectionKey, data > > currently we have mapped the collection using property-ref > > for entityA > > <map name="data" table="TableB"> > <key column="collectionKey" property-ref="key"/> > ... > </map> > > The problem is if we load the two instances of entityA which are using the > same collectionKey, we get lazy exception when accessing the collection. > > We know that we could solve the problem by adding an entity which holds > the collection (mapped using an additional table for the relations). > But that would add an overhead with an additional join. >
This sounds like your best bet IMO. Separate the collection head entity, and many-to-many join to the parent entity. Does anyone have experience of solving this problem by using some kind of > shared collection? > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
