Allen Gilliland wrote: > > > Elias Torres wrote: >>> >> >> In general I'm getting that putting code that modifies the db inside the >> POJO might be just the wrong approach since Hibernate does support >> transient and detached objects. Therefore we should try to do things in >> the WeblogManager.save(). Any objections of going that route? > > Maybe I don't fully understand the problem because I am not working on > the code, but somehow it feels like we are making this too complicated. > I think you should be focusing on the way the formbean/action process > works, not on the pojo. Why don't you just use the formbean to extract > the list of tags which were entered by the user, and then in the struts > action you can figure out which tags are being added/removed and call > the appropriate manager methods to update the aggregate data for those > tags.
I think that it would work, the only possible gotcha with this approach is that we must make sure we do tag accounting anywhere else we manipulate tags such as Atom/Blogger/MetaWeblog APIs for example. > > I know that it seems nice if a call to entry.addTag() automatically > updates the aggregate data for a tag, but maybe that's not really ideal. > As Anil suggested, that creates a dependency between a tag and it's > aggregate data which we don't necessarily want, so instead of putting > the logic in the pojo method just put it wherever calls that method, > namely the struts action. So whatever is calling entry.addTag() can > also call weblogMgr.incrementTagAgg(). > > -- Allen >
