-->
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.  [ 5 posts ] 
Author Message
 Post subject: DELETE + INSERT in stead of UPDATE on Hypersonic
PostPosted: Mon Jan 12, 2004 4:25 pm 
Newbie

Joined: Mon Jan 12, 2004 4:19 pm
Posts: 3
Hi

I am observing interesting behaviour while using Hibernate 2.1.1 within JBoss with a Hypersonic DB - I scanned the FAQ, so apologies if I missed it. This might also be expected behaviour for HsqlDB, in which case I'll rest my case :)

When performing a Session.saveOrUpdate() on a simple object (I tried plain objects, even bi-directional many-to-many which all work!), I see from the log that Hibernate is attempting to perform an UPDATE, but in the end does a DELETE and then INSERT operation.

Is this expected? I have dynamic-updates="true" and mutable="true" on my object... My concern is the impact on referential integrity etc. etc.

Thanks,
Hendrik


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 12, 2004 4:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
How does the log look like?


Top
 Profile  
 
 Post subject: JBoss log + HSqlDB log
PostPosted: Tue Jan 13, 2004 3:22 pm 
Newbie

Joined: Mon Jan 12, 2004 4:19 pm
Posts: 3
The JBoss log contains the following:

2004-01-13 14:17:11,329 INFO [STDOUT] Hibernate: update USER set password=?, browserType=?, enableAutoRefresh=?, styleSheet=?, renderOperationResultAsHTML=?, refreshInterval=?, username=?, email=? where id=?
2004-01-13 14:17:11,369 INFO [STDOUT] Hibernate: update ROLE set name=? where id=?
2004-01-13 14:17:17,418 INFO [STDOUT] Hibernate: update USER set password=?, browserType=?, enableAutoRefresh=?, styleSheet=?, renderOperationResultAsHTML=?, refreshInterval=?, username=?, email=? where id=?
2004-01-13 14:17:17,438 INFO [STDOUT] Hibernate: update ROLE set name=? where id=?

Hypersonic's default.script however, contains the following corresponding statements:

DELETE FROM USER WHERE ID=0
INSERT INTO USER VALUES(0,'opentier','default',false,'default',false,30,'admin','testAddress')
DELETE FROM ROLE WHERE ID=0
INSERT INTO ROLE VALUES(0,'Admin')
DELETE FROM USER WHERE ID=1
INSERT INTO USER VALUES(1,'opentier','default',false,'default',false,30,'user','testAddress')
DELETE FROM ROLE WHERE ID=1
INSERT INTO ROLE VALUES(1,'User')

Am I misusing the Session object somehow? Currently I create a Session, get the object and close the Session. I then change the object, create a new Session, and saveOrUpdate() the object...

Any help is very much appreciated!

-Hendrik


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2004 5:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is just Hypersonic, it never stores UPDATEs in its script file, allways first a delete and then an insert with new data. Only the hibernate log shows the SQL really executed by hibernate.


Top
 Profile  
 
 Post subject: Thanks!
PostPosted: Tue Jan 13, 2004 6:18 pm 
Newbie

Joined: Mon Jan 12, 2004 4:19 pm
Posts: 3
Hi

That explains it then... Thank you very much!!

-Hendrik


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