-->
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.  [ 8 posts ] 
Author Message
 Post subject: ObjectNotFoundException since 2.1 rc1
PostPosted: Mon Dec 15, 2003 9:29 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 4:17 pm
Posts: 27
Location: California, USA
Upgrading from Hibernate 2.1 beta 6 to 2.1 rc1 causes more exceptions like this one to occur:

Code:
net.sf.hibernate.ObjectNotFoundException: No row with the given identifier exists: {11, 42}, of class: com.docent.lms.entities.reference.ReferenceDomainAncestry
at net.sf.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:24)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1846)
at com.docent.lms.entities.reference.GeneratedDomainAncestry$Factory.getById(GeneratedDomainAncestry.java:345)
... 70 more

These new exceptions cause problems, when they propagate into my application.

Do you have some idea what changed in Hibernate? What I can do about it? (I am trying to figure it out on my own, of course.)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 3:11 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 4:17 pm
Posts: 27
Location: California, USA
It appears that Hibernate 2.1 rc1 (and 2.1 final) flush more frugally; that is, they don't flush changes to the database in situations wherein previous releases would flush changes. This is an improvement, I trust. But it exposed a bug in my application: my code was implicitly relying on the extra flush to insert a row into the database, which causes the execution of a trigger which inserts other rows, which my application expects to load from the database via Hibernate. When the flush didn't happen, the attempt to load from the other rows failed with ObjectNotFoundException.

I changed my application to call Session.flush() before attempting to load the other rows, with satisfactory results.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 5:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I don't recall making any changes here.

Exactly what what was the code?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 6:55 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 4:17 pm
Posts: 27
Location: California, USA
I looked at DEBUG log output, comparing logs from 2.1beta6 to logs from 2.1rc1, and saw flush activity in the former but not the latter (under similar circumstances). But I don't understand the Hibernate code well enough to identify the change therein.

My application is rather large and not open source. So I can't share its code with you, I'm sorry to say. :-(


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 7:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Could you just try and verify that the flush was not required for the query that was executed? I'm certain this stuff is implemented correctly, but I'm very surprised to see a change in behavior....


Hibernate should flush if there are in-memory changes to a table that appears in the where clause (or order by or group by clause) of the query.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 7:52 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 4:17 pm
Posts: 27
Location: California, USA
Yes, Hibernate 2.1 beta 6 executed a flush that was not required by a subsequent query (that I can see). The flush executed a SQL "insert into DRDomainMembership", and then Hibernate returned control to the application without executing a SQL query that mentioned DRDomainMembership.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 7:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hrrrmph ... ok then, cool.

Must have changed something after all.....


Top
 Profile  
 
 Post subject: More info
PostPosted: Wed Feb 18, 2004 5:58 pm 
Newbie

Joined: Tue Feb 17, 2004 7:34 pm
Posts: 5
Actually, by inserting a row into a table, say table Albert. This table is emptied. Then I try to use a different DB user and doing the same thing, a new table Albert is created by this new user.

By retrieving a row from the table, the table is emptied.

Something is really wrong with this.

Later on, I use hibernate version 2.0.3, everything works fine with a single line of code change. So I think there is serious problem with the current 2.1.2 release.

Thanks,
John


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