-->
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.  [ 2 posts ] 
Author Message
 Post subject: Preprocessing an object before it is automatically persisted
PostPosted: Thu Jan 11, 2007 9:17 pm 
Newbie

Joined: Thu Jan 11, 2007 9:01 pm
Posts: 2
Hello everyone.

I am currently using Hibernate 3.1.3.

I have an object A that has a reference to another object B, which has a reference to another object C and so on.

I have set up cascading save and update so that persistence of A automatically persists B and C and ....

Here is my question: to persist one of these object along the chain, say C for this conversation, I need to do some preprocessing of that object and then have it persisted (as usual). Since I don't explicitly call any API to persist C directly (it gets persisted as part of the persistence of A), what are the options to hook into the logic that does the persistence of C down the chain? Is there an event that I can listen to, or a callback that I can register, or a method that I can override?

Many thanks
Ali.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 12, 2007 2:04 am 
Newbie

Joined: Tue Dec 19, 2006 11:05 am
Posts: 11
Probably a hibernate interceptor is what you need...
You can pass the interceptor to the openSession method at the session factory...

see http://www.hibernate.org/hib_docs/v3/re ... le/#events


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.