-->
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: EventListeners - would like to have a list...
PostPosted: Tue May 31, 2005 5:36 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 4:20 pm
Posts: 29
The current implementation of EventListeners looks like I can have only one of each type, i.e. only one postUpdateEventListener. I would like to have a list or set of postUpdateEventListeners. The reason is that we have the need to insert a history record based on data changed on multiple tables.

Currently, I have a budget and budget history table. When the budget is updated, I need a budget history record created that stores the old state of the budget. I implemented a budgetPostUpdateEventListener that creates the record when an enitity type of budget is updated.

Now I would like a userPostUpdateEventListener. Should I put in a JIRA request to extend the EventListeners to be a list of listeners of each type?

I do not think it is desireable to have a big switch statement inside of my postUpdateEventListener.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 5:45 pm 
Senior
Senior

Joined: Tue Feb 08, 2005 5:26 pm
Posts: 157
Location: Montréal, Québec - Canada
I believe you could use chained interceptors.

Read: http://www.hibernate.org/92.html

_________________
Vincent Giguère
J2EE Developer


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 9:47 am 
Beginner
Beginner

Joined: Thu Feb 17, 2005 4:20 pm
Posts: 29
Yes, I had thought of that. That model does make sense for the interceptor.

However, for the event model, I would have to re-implement the chaining for each event I need to chain. It would be far better if that support was already in hibernate. For example, if I needed to do something with the FlushEntityEvent I could just add an additional listener as opposed to extending or implementing the functionality of the default FlushEntityEvent.


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.