It is good that now the business objects 'almost' have no dependencies on the persistent framework, either by inheritance from a heavy persistent base class, or by invoking framework API within the business object.
however, the Lifecycle interface still causes such dependency. as a result we can not say use the object in a client application. some heavy logics triggered by life cycle event has to be put into the business object which brings even more dependencies. and it is inconvinient to customize different actions responding life cycle event for different deployment environment (out product needs different action for different customer)
unfortuntely JDO also has the same approach. your divine POJO is tainted with sign of ugly beast in the background.
I fully understand the reason for this approach, but I'd really like to have an alternative, event-listener based mechanism, so that the logics in reponse to persistent events are not coupled inside the business object. something like HB.register(Cat.class, aDeleteListener). this is a tiny bit more coding work, but the benefit will be great.
|