-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping timestamp to column in component mapping.
PostPosted: Wed May 10, 2006 6:59 am 
Newbie

Joined: Mon Feb 27, 2006 12:02 pm
Posts: 8
Hello. I have some question regarding the mapping please.

Currenly I am migrating my project from using TopLink to Hibernate. In all of my table, there is a column named "LAST_CHNG_DTTM" which is used as timestamp column for optimistic lock checking. This column is mapped to "modifyTime" property of Aufir domain object which is mapped using component mapping with all other domain object.

My question is how can I mapped this timestamp column. Currently it seem that <timestamp> element is not support within <component> elelment. If current Hibernate does not support this kind of mapping, is there any suggestion? If possible, I do not want to change my existing domain objects.

Following is the example of my mapping. I want to change the mapping of "modifyTime" property from <property> to <timestamp>

Code:
<hibernate-mapping package="com.pws.ubiquity.common.domain"
   default-access="field">
   <class name="CommonConstraintGroup" table="CO_SYST_CSGP">
      <id name="code" column="CO_SYST_CSGP">
         <generator class="assigned" />
      </id>
      <property name="description" column="CSGP_DESC" />
      <property name="dataType" column="CSGP_DATA_TYPE" />
      <property name="maxLength" column="MAX_CODE_LNTH" />
      <property name="owner" column="OWNR_FLAG" />
      <property name="label" column="CSGP_LABL" />

      <component name="audit" class="Audit">
         <property name="createdBy" column="CRTD_BY" />
         <property name="createTime" column="CRTD_DTTM" />
         <property name="modifiedBy" column="LAST_CHNG_BY" />
         <property name="modifyTime" column="LAST_CHNG_DTTM" />
      </component>
   </class>
</hibernate-mapping>


Thank you very much in advanced.

Best regards,


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 10, 2006 8:58 am 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
<property name="modifyTime" column="LAST_CHNG_DTTM" type="timestamp"/>


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 7:02 am 
Newbie

Joined: Mon Feb 27, 2006 12:02 pm
Posts: 8
Hi. Thanks for your reply. But isn't what you suggested mapping is just to specify the datatype of the field that it is timestamp type? Does it tell hibernate that I want that field to be timestamp (version) field to be used for optimistic lock as the purpose of <timestamp> and <version> tags ? If so, can I also use type = "version" to specifiy that the field is version field ?

Thank you very much and best regards,


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.