I have an application with a lot of entities with relations to each other. E.g cars, wheels, paint, seats, bolts, ...
The (client) application directly directly talks to a database and uses a office wide memcache, so caching is a concern as well. The object model is too large to keep everything in memory, so a form of lazy loading is needed. This is a GUI application so startup performance is an issue as well.
My question is where to draw the line between entities and their relations, are there any best practices.
Possibility one: make the entities responsible for the relations. In reality this demands that the entities keep a reference to the service
Possibility two: relations are kept in the service. Entities are value objects only, keeping only a reference to the ID's of their children. Every time a child lookup is needed, the service should be called.