-->
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.  [ 4 posts ] 
Author Message
 Post subject: Adding one object while adding another
PostPosted: Wed Jan 14, 2004 3:33 pm 
Newbie

Joined: Wed Jan 14, 2004 3:27 pm
Posts: 4
Hello, I'm trying to add an object/record during an onSave/onUpdate of another one, but without success.
Do i need to use an Interceptor for these kind of tasks, or do i need to perform something special for these operations of nested insertion/update ?

Thx in advance,
kiuma


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2004 6:27 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 7:53 pm
Posts: 66
Location: Lakeland, Florida USA
The LifeCycle interface is intended for this purpose. What kind of problems are you having?

Jeff


Top
 Profile  
 
 Post subject: onSave does not work to me
PostPosted: Thu Jan 15, 2004 5:17 am 
Newbie

Joined: Wed Jan 14, 2004 3:27 pm
Posts: 4
The problem is this :
I've this method

public class FlussoH

public boolean onSave(Session s) throws net.sf.hibernate.CallbackException {
String italiani = (istatRegione == null)?"F":"T";
FlussoRiepH fr = addFlussoToRiep(italiani, s); //<--- Here i call s.saveOrUpdate(fr)
setFlussoRiep(fr);
return super.onSave(s);
}

during session.flush i have a classCastException whose message is null


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 9:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You should not execute functions accessing the session and modifying other objects in the Lifecycle interface functions.


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