-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Event Model
PostPosted: Mon Sep 06, 2004 4:26 pm 
Newbie

Joined: Mon Sep 06, 2004 4:11 pm
Posts: 6
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 06, 2004 8:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I consider this to be a part of the business logic. Typically you would see a notification (say email delivery [did not say what type or use of the even notification]) gets called as a part of application flow. In larer systems I would link this type of functionality to a Rules or Workflow engine.


Top
 Profile  
 
 Post subject: Event Model
PostPosted: Tue Sep 07, 2004 9:34 am 
Newbie

Joined: Mon Sep 06, 2004 4:11 pm
Posts: 6
I agree but I'm struggling to figure out how I can incorporate workflow fits into the application.

In this application, a Project has a collection of TeamMembers (which are actually an association between a Person, Role, and Project). With this type of association adding a new TeamMember is simply a matter of constructing a TeamMember (using the selections made by the user) and calling project.addTeamMember(TeamMember) and calling hibernate saveOrUpdate(Project).

Given that scenario can someone describe how that should be implemented in terms of design? Right now the web-tier (struts actions) do the work of manipulating the Project by adding new TeamMembers, adding new Story objects, etc. Then call into the business service object which uses hiberate DAOs to save the changes to the project.

How should this be implemented? How does my business service object know what has changed in my project so that it can perform the other non-persistance related actions that go along with assigning a new team member (email notification)?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.