-->
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.  [ 8 posts ] 
Author Message
 Post subject: Lyfecycle and update other objects
PostPosted: Wed Nov 12, 2003 3:41 am 
Beginner
Beginner

Joined: Tue Oct 28, 2003 6:43 am
Posts: 33
I need to update some other object when i update an object: in other words, when i update an object i need to refresh a date in a record of another table. How can I do that?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 8:50 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
By reading the doc. Your question is too vague.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Not so vague
PostPosted: Wed Nov 12, 2003 9:47 am 
Beginner
Beginner

Joined: Tue Oct 28, 2003 6:43 am
Posts: 33
I only need to update an object "y" every time that I update the object "x". So I insert in the update method of lifecycle of the object "x" the instruction to do so... but the method update isn't call!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 10:08 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Quote:
Note that onUpdate() is not called every time the object's persistent state is updated. It is called only when a transient object is passed to Session.update().

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 10:09 am 
Beginner
Beginner

Joined: Tue Oct 28, 2003 6:43 am
Posts: 33
So how can I do what I need?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 11:05 am 
Newbie

Joined: Tue Oct 28, 2003 8:00 am
Posts: 16
Location: Karlsruhe, Germany
take a look at interceptor, perhaps onFlushDirty solves your problem ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 11:08 am 
Beginner
Beginner

Joined: Tue Oct 28, 2003 6:43 am
Posts: 33
but in the interceptor I haven't hibernate session


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 5:32 am 
Newbie

Joined: Tue Oct 28, 2003 8:00 am
Posts: 16
Location: Karlsruhe, Germany
I still haven't tried this but I want to this.

you create the interceptor the same place where you open the session so you could associate the session to your interceptor if you need the same session.
But I don't know if you can use the session who calls the interceptor in this method of the interceptor.


I want to check changes in a persistent object before update and create a changelog entry so I will try something similar with my interceptor too.


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