-->
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: Upgraded to 3.2.5: instance does not yet exist as a row
PostPosted: Fri Dec 21, 2007 1:46 pm 
Newbie

Joined: Fri Dec 21, 2007 1:11 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.2.5ga

Mapping documents:not relevant

Code between sessionFactory.openSession() and session.close():
Code:
session.save(newObject);
session.refresh(newObject); //needed because a trigger is involved
...
session.flush();



Full stack trace of any exception that occurs:
HibernateException: this instance does not yet exist as a row in the database


Name and version of the database you are using:
Oracl10g



Hi,

I switched from Hibernate 3.1.2 to 3.2.5ga. The above code snippet worked in version 3.1.2. After upgrading to 3.2.5ga I get the HibernateException: this instance does not yet exist as a row in the database.

When I remove
Code:
session.refresh(newObject)
it works. However I need to refresh the object because a trigger on the database added some values.

Why does Hibernate 3.2.5ga behaves differently in comparison to 3.1.2?! Has something changed which I have to consider?

greetings,
Tina


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 21, 2007 9:18 pm 
Regular
Regular

Joined: Sat Nov 25, 2006 11:37 am
Posts: 72
Try putting the session.flush() after the save() and before the reset(). Hibernate uses delayed inserts/updates whenever it thinks it can. flush() forces it to write everything that is marked as new or dirty to the database.

Another option would be to marked the columns which your trigger updates as 'generated'. That should make the save() execute immediately and the refresh() unnecessary.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 22, 2007 5:06 am 
Newbie

Joined: Fri Dec 21, 2007 1:11 pm
Posts: 2
malm66 wrote:
Try putting the session.flush() after the save() and before the reset(). Hibernate uses delayed inserts/updates whenever it thinks it can. flush() forces it to write everything that is marked as new or dirty to the database.

Another option would be to marked the columns which your trigger updates as 'generated'. That should make the save() execute immediately and the refresh() unnecessary.


thanks for your answer. I have tried both options and now I am getting the error message "the row with the given identifier does not exist".

This is really strange because we did not change anything to the code or mappings and all works well with the prior Hibernate 3.1.2.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 22, 2007 5:46 am 
Regular
Regular

Joined: Sat Nov 25, 2006 11:37 am
Posts: 72
Sorry you had no success with my suggestions. I have no idea what has changed between 3.1 and 3.2. The error message seems to indicate Hibernate has problems locating the saved object. Are you using a database generated primary key or an application provided primary key? If it is a database generated primary key something must have gone wrong with getting it back into your object. If you can't step through your application with a debugger add a log statement which logs the relevant fields from your newObject. Also enable Hibernate statement logging and check what is actually submitted to the database.


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.