Let's say I have an entity called MyItem. It can be included in many "parents", like SomeCollection and SomeOtherCollection. Because it can be included in many parents, and since I don't want MyItem to know about the parents, I'd like to not have any properties in MyItem referencing a parent.
And since a parent, like SomeCollection, can contain many many MyItems, I feel like I need to have some sort of paging involved in getting the children from a parent. This would keep me from having a property in SomeCollection referencing MyItems. Lazy loaded or not, it's always "all or nothing" (right?).
I definitely need some reference between MyItem entities and their parents though, in the form of a mapping table in the database.
Questions:
- How do I create mappings for this? Can I have mappings, or should the relation be kept in the business logic instead?
- How would I query which MyItem entities exist in SomeCollection? Can I do this with only one trip to the database using ICriteria?