If you access the collection, it WILL be loaded (otherwise, the in-memory model would have an inconsistency) With one-to-many+many-to-one on the other side, it's easy to do, you just create the relationship on the other side (the one that has many-to-one. With many-to-many, well, you could choose the side that has less elements to work from, or refactor the relationship into two one-to-many collections with an intermediate entity, so you can just create instances of that entity. In any case... you should do these things ONLY if you are experiencing perfomance problems because of the collection load. Are you?
Diego On Mon, Feb 22, 2010 at 13:53, Jonathan Curtis <[email protected]>wrote: > We have a entity with a many-to-many collection mapped as a lazy > loaded bag. When we load up the entity, the collection is not loaded - > great. Now we want to add a new entity to that collection. As soon as > we do this, the collection is loaded up. > > How do we add the new entity without loading up the whole collection > (the collection is large)? > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
