How to get unsaved-value="undefined" in the mapping file?I am using XDoclet and ant to generate mapping file.
I am getting StaleObjectStateException when trying to update a row.
Even tho when I provide tag
@hibernate.timestamp unsaved-value="undefined", this is not being generated in the mapping file, because of which I am getting Staleobject Exception.
Hibernate version:2.1.2
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping> <class name="com.systec.lifetec.labs.valueobjects.ResultCodeVO" table="tbl_test_result_code" dynamic-update="false" dynamic-insert="false" >
<id name="resultCode" column="result_code" type="java.lang.String" > <generator class="assigned"> </generator> </id>
<timestamp name="updateDateTime" column="updt_datetime" />
<property name="description" type="java.lang.String" update="true" insert="true" column="description" />
<property name="active" type="boolean" update="true" insert="true" column="active" />
<property name="showInLegend" type="boolean" update="true" insert="true" column="show_in_legend" />
<property name="userID" type="java.lang.String" update="true" insert="true" column="updt_userid" not-null="true" />
<!-- To add non XDoclet property mappings, create a file named hibernate-properties-ResultCodeVO.xml containing the additional properties and place it in your merge dir. -->
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Session ss=openSession(); Transaction tr=ss.beginTransaction(); ss.update(resultCodeVO); tr.commit(); ss.close();
Full stack trace of any exception that occurs:
Name and version of the database you are using:SQLServer 2000
Debug level Hibernate log excerpt:
|