-->
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.  [ 1 post ] 
Author Message
 Post subject: StaleObjectStateException with Jdbc Driver 9.2.0.5.0
PostPosted: Mon May 29, 2006 5:45 am 
Newbie

Joined: Mon May 29, 2006 5:20 am
Posts: 5
Hi everyone.
I'm having trouble upgrading my jdbc driver with Hibernate.
When I'm updating a column with is NOT the <version .. /> column, I get a StaleObjectStateException, using JDBC driver 9.2.0.5.0 (Oracle Thin Driver ojdbc14-9.2.0.5.jar).
When I'm using a previous driver (Oracle Jdbc Driver 8.1.7.1.0 ; classes12.jar) I dot not have this exception.

Can someone help me ?
Is this a JDBC Driver bug ?
An Hibernate bug ?
An uncorrect coding bug ?

Thanks for any help.

Hibernate version: 2.1.3

Mapping documents:
<class name="com.etc.Incident" table="INCIDENT">
<id column="PK_INCIDENT" name="id" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">S_INCIDENT</param>
</generator>
</id>
<version column="DATE_MODIFIED" name="dateModified" type="timestamp" />
<property column="FK_CURRENT_DOCUMENT" length="3" name="fkCurrentVersionDocument" type="java.lang.Long"/>
...
</class>


Code between sessionFactory.openSession() and session.close():
tx = session.beginTransaction();
IncidentDAO dao = factory.getIncidentDAO(session);
Incident incident = new Incident();
incident.fillNewIncidentInfo();

dao.save(incident);

Document doc = incident.getCurrentDocument();
doc.filNewDocInfo();
dao.save(doc);

// For test purpose
try {
session.commit(tx);
} catch (Exception e) {
e.printStackTrace();
}

session.evict(incident);

tx = session.beginTransaction();

// End of test

incident.setFkCurrentVersionDocument(doc.getId());

// incident.dateModified is the same in database and in object (debug test)

dao.update(incident);

try {
session.commit(tx);
} catch (Exception e) {
e.printStackTrace();
}


Full stack trace of any exception that occurs:
net.sf.hibernate.StaleObjectStateException TRAS0014I: The following exception was logged net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.valeo.srm.ims.bo.IncidentHeader instance with identifier: 1496
at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:513)
at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:664)
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.valeo.srm.dao.DAOHibernateSession.commit(DAOHibernateSession.java:41)
at com.valeo.srm.ims.service.IncidentManager.save(IncidentManager.java:2346)


Name and version of the database you are using:
Oracle 9.2.0.1.0


The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
Fatal


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.