Salut,
J'ai utilisé le code de Hanson que l'on peut trouver à cette addresse (
http://hansonchar.blogspot.com/2005/06/ ... te-in.html). Toutefois j'obtien l'erreur suivante soit un update après mon insert.
Pouvez-vous m'aider?????
Merci
Hibernate version:
Hibernate 2.1.x
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
package="MyPackage"
default-cascade="save-update">
<class name="DigitalFile" table="DIGITAL" >
<id name="id"
column= "FILE_NAME"
type="java.lang.String"
length="10">
<generator class="assigned"/>
</id>
<!-- NOTE: Timestamp needed because assigned identifier.when using
TIMESTAP tag,ensure date field is not instatiated in the class -->
<timestamp name="dateChanged"
column="CHANGED_ON"
unsaved-value="null"/>
<!--TIMESTAMP values-->
<property name="lastModified"
type="timestamp"
column="LAST_MODIFIED"
update="false"/>
<!--Regular ATTRIBUTE values-->
<property name="filesize"
type="java.lang.Long"
column="FILE_SIZE"
update="true"
insert="true"
not-null="false"/>
<property name="filecontentBlob"
type="blob"
column="FILE_CONTENTS"/>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
[25/08/05 10:31:19:205 EDT] 68ac0279 SystemOut O Hibernate: update DIGITAL set CHANGED_ON=?, FILE_SIZE=?, FILE_CONTENTS=?, CHANGED_BY=? where FILE_NAME=? and CHANGED_ON=?
[25/08/05 10:31:19:355 EDT] 68ac0279 StaleObjectSt W net.sf.hibernate.StaleObjectStateException An operation failed due to stale data
[25/08/05 10:31:19:395 EDT] 68ac0279 StaleObjectSt W 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 SAP.BusinessObjects.DigitalFile instance with identifier: 0000000093.pdf
Name and version of the database you are using:
Oracle 9.x
The generated SQL (show_sql=true):
true
Debug level Hibernate log excerpt: