-->
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 successful even if no record exists...???
PostPosted: Mon Apr 11, 2005 12:14 pm 
Beginner
Beginner

Joined: Tue Feb 01, 2005 8:38 am
Posts: 38
Hi, I'm using Hibernate 3.0 and I have noticed that if I try to update an object using

session.update(Object obj)

and there is currently no corresponding database record for that object, the update executes successfully anyway! No record is added but I would have expected that calling update for an object with no corresponding db record would throw an exception - n'est pas? Is this a bug or am I missing something? Surely you cannot update an object/record that hasn't already been persisted?

If there is a record matching the Id of the object, then that record does get updated successfully.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 11, 2005 12:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Don't believe you. Hibernate checks the JDBC row count and throws a StaleObjectStateException if it is <1.

Perhaps you are swallowing exceptions.


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.