-->
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: Update always issued after insert
PostPosted: Fri Nov 12, 2004 4:45 pm 
Newbie

Joined: Fri Nov 12, 2004 2:46 pm
Posts: 2
Hibernate version:
2.1.6

Name and version of the database you are using:
Oracle 9i

Here's the scenario : Parent class P has a set of child elements C, and I am mapping this collection as a one-to-many relationship between P and C. I am using inverse=true, and cascade='all-delete-orphan".

However, when I save the parent P, Hibernate issues two SQL statements for both P and C. The first two statements insert P and C, and the next two statements update P and C. The updates are always redundant, and should not be issued because the relationship between P and C is created during the inserts.

What could I be doing wrong ?

Thanks,
-Anurag


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 10:31 am 
Newbie

Joined: Fri Nov 12, 2004 2:46 pm
Posts: 2
I managed to solve the issue - I was changing the state of the object in the onFlushDirty() and onSave() methods, which is why Hibernate always found a dirty object during persistence, and issued an update after the insert. Better documentation of the Interceptor would probably have been helpful.


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.