-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate Event Listener API Help needed
PostPosted: Fri Aug 12, 2005 12:16 pm 
Newbie

Joined: Fri Aug 12, 2005 12:13 pm
Posts: 5
I am trying to persist an entity A, which has a many-to-one relationship to entity B which it holds as an instance member.

I have defined the relationship in A.hbm.xml with cascade="save-update".

However because I am working with a legacy system, I need to alter the state of A, B in the same way for save and update.

In fact I am adding modifiedOn, modifiedBy, createdOn, createdBy properties and obtaining identifiers in a custom way.

I decided the best way to do this was using the Event Listener API.

So I have defined a listener for Save and one for Update.

When I persist B on its own it works fine.

When I add a transient B to A and try to persist A, the listener is not called on B hence cascade save cannot happen.

Doesn't the event api get called for entities that are being saved by cascade?


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

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.