-->
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: DefaultSaveOrUpdateEventListener.onSaveOrUpdate()
PostPosted: Wed Dec 12, 2007 5:50 am 
Newbie

Joined: Mon Dec 10, 2007 10:21 am
Posts: 4
Hi,

I have a class that extends DefaultSaveOrUpdateEventListener, that overrides public void onSaveOrUpdate(SaveOrUpdateEvent event).

The method is supposed to be called whenever a Save or Update is about to happen and set the audit fields (created and updated timestamps) on the object to be saved.

For some reason, this method is getting called when the session/transaction commits on a hibernateTemplate.get(class, id).

It only occurs when doing a get() on a parent object with a collection of child objects (standard one-to-many)

So the question is:

Why is the DefaultSaveOrUpdateEventListener.onSaveOrUpdate(SaveOrUpdateEvent event) method being called when the session commits at the end of a hibernateTemplate.get(class, id) call?

And why does it only happen on objects in a collection?

Thanks.


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.