-->
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: Is there any tag in XDoclet for unsaved-value for timestamp?
PostPosted: Fri Aug 27, 2004 7:38 am 
Beginner
Beginner

Joined: Wed Jul 21, 2004 7:48 am
Posts: 21
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:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 06, 2004 6:09 am 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:57 am
Posts: 33
Location: Alpharetta, Georgia
unsaved-value=null works for me.


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.