Hi,
I've been searching and reading posts and articles around this website, tring to decide whether I should implement all the relationship handling into my DAO or leave it to the business logic layer.
By relationship handling, I mean calling the stuff like addChild(), add Parent(), and deleteChild() etc.
My feeling is to include these in the DAO layer, because the associated objects are initialized (lazy or not) anyway through a single DAO method call.
But when considering things like a composition relationship, questions like "should I create the child from within the parent creation code?" got me into lost:
1. If I do create children in the parent creation code, then the ParentDAO should know about childDAO, which may lead to a very complicated DAO structure;
2. If I leave the child creation to the business logic, then the business logic will be required to know all the data manipulation details, which ideally should be hidden behind the DAO layer.
Any comments/suggestions?
Thanks,
Dan