-->
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: How to use generator with Timestamp primary keys
PostPosted: Wed Jun 30, 2004 4:24 pm 
Newbie

Joined: Wed Jun 30, 2004 3:51 pm
Posts: 7
I am accessing UDB 7.2.8 and 8 (DB2 for Distributed platforms).

Our DBAs use Timestamps for primary keys on the tables.
There is no need to use any generator strategy since current
Timestamp gets inserted as we create the row.

My question is:

How do I set up the mapping for the
ids - specifically for the generator.

One of the mapping files may look like this. I put the generator
as native just to have something there.

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping.dtd">
<hibernate-mapping>
<class name="com.labcorp.test.Level" table="SKILSTRK.COMP_LEVEL">
<id name="timestampId" column="SKILSTRK.COMP_LEVEL.COMP_LEVEL_ID" type="timestamp">
<generator class="native"/>
</id>
<property name="description" column="SKILSTRK.COMP_LEVEL.DESCRIPTION_TXT" type="string"/>
<property name="levelName" column="SKILSTRK.COMP_LEVEL.COMP_LEVEL_NM" type="string"/>
</class>
</hibernate-mapping>


Please help,
Edmon B.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 30, 2004 4:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Either write your own generator which retrieves the generated ts from the database after inserting, or use assigned and do a refresh after save.


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.