-->
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: Update by version-tag
PostPosted: Wed Jul 26, 2006 7:45 am 
Newbie

Joined: Wed Jul 26, 2006 6:01 am
Posts: 10
Hibernate 3.2 cr2:
Server: MS Sql 2000


Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="database.structure">
  <class name="Object">
     <id name="id" type="int" column="OBJECTID">
        <generator class="native"></generator>
     </id>
     <version name="createDate" type="timestamp" insert="true" ></version>
  </class>
</hibernate-mapping>



Hi,

I try to create a field "createDate", it should save current date at SQL-Insert.

In my case it created the rigth date BUT by sql-updating it rewrite the date.

How i can avoid it?

thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 9:07 am 
Newbie

Joined: Wed Jul 26, 2006 6:01 am
Posts: 10
i solve my problem self:

Code:
<property name="createDate" type="timestamp" insert="false" update="false">
   <column name="createDate" default="getdate()"></column>
</property>


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.