-->
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: HibernateException (row not found) thrown instead
PostPosted: Tue Dec 12, 2006 2:57 am 
Newbie

Joined: Tue Dec 12, 2006 2:41 am
Posts: 1
I have a test application where one thread selects a row from the database, and goes to sleep.
Another thread wakes up and selects the same row, modifies the content and commits the changes.
When the first thread wakes up, tries to modify the same row and commit it, i expect a StaleObjectStateException to be thrown, but instead I am getting HibernateException(row not found)
Note that the same application works fine and StaleStateException is thrown in hibernate version 3.1, but in case of 2.1.8 it does not seem to work.

My mapping file is as below:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.fst.example.Event" table="EVENT_CMPTEST" dynamic-update="true">
<cache usage="read-write"/>
<id name="id" type="string" column="ID">
<generator class = "uuid.hex" />
</id>
<version name="version" column="VERSION"/>
<property name="eventType" type="string" column="EVENT_TYPE"/>
<property name="timeReceived" type="timestamp" column="RECEIVED_AT" update="false"/>
<property name="expiryTime" type="timestamp" column="EXPIRES_AT" update="false"/>
<property name="deliveryTime" type="timestamp" column="DELIVER_AT" update="false"/>
<property name="host" type="string" column="HOST_NAME"/>
</class>
</hibernate-mapping>


I have an attribute version, and the setter and the getter for the same in the bean.

Hibernate version: 2.1.8

Stack Trace:
net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row not found)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:25)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:661)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:621)
at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at com.fst.example.TestExample.main(TestExample.java:67)
12:28:15,941 ERROR SessionImpl:2400 - Could not synchronize database state with session


Name and version of the database you are using: MySQL , version 5

Please let me know if I have missed out on anything, or if it is a bug in 2 version. I am having problems in migrating to version 3 as there are a lot of dependencies in my application. It would be the best if I can get it working in the version 2.1.8.


Top
 Profile  
 
 Post subject: Generated SQL
PostPosted: Tue Dec 12, 2006 6:21 pm 
Beginner
Beginner

Joined: Thu Apr 27, 2006 12:19 pm
Posts: 33
Location: Seattle, WA
How does the generated SQL compare between 2.1.8 and 3.1? Perhaps Hibernate 2.x is doing something with the version column or something. If the generated SQL is different it may at least help narrow it down a bit.


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.