We have employees, for example. EmployeeDAO and the standard hibernatetemplate stuff with OpenSessionInViewInterceptor. It's all working fine. The "owned" objects (declared in the mapping) are cascade deleted successfully.
As we add new subsystems to the application, we find other domain objects which refer to an association with an employee. We would like to be able to add such subsystems without having to alter the existing mapping of the Employee - we're using XDoclet to generate those by the way. The Employee doesn't own these other objects (object graphs), doesn't own the associations, to be exact doesn't even know they exist.
Some of these other systems are interested in Employee delete events. I may not have access to the EmployeeDAO code, so I can't just add new methods to it to generate or publish events. Is AOP an answer here? Can I intercept delete methods in various DAOs and have them publish EmployeeDeleteApplicationEvents, so to speak? Is this a path worth pursuing, does anybody here have experience with similar situations?
I don't see a lot in the docs about ApplicationEvents, I would also appreciate any advice as to their successful implemention in Spring.