I'm building my first significant application with Spring & Hibernate and am trying to figure out how to generate application events as objects are persisted. My application is centered around a project. A project has many properties and associated objects. The user manipulates a project through a web interface where they can assign new team members to a project, create new stories within the project, etc. Each time the user saves the project, hibernate's saveOrUpdate() method is invoked with the project as the argument. Of course hibernate manages the updates to the associated objects. When certain objects within the project are updated in the db I would like to generate event notifications (when team members are added, when a story is assigned to a team member, etc)
How can I do this with Hibernate 2.1.6? I've seen the Lifecycle inteface but 1) don't want to couple my domain objects to hibernate and 2) don't think this will work since the lifecycle methods are called before updates are made. Looks like 3.x introduces a richer lifecyle model but is there a way to do this in 2.x?
Any ideas?
Thanks,
Norm
|