-->
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.  [ 1 post ] 
Author Message
 Post subject: binary key - one field assigned, the other generated - howto
PostPosted: Mon Jul 31, 2006 12:31 pm 
Beginner
Beginner

Joined: Tue Jul 25, 2006 12:34 pm
Posts: 25
Hibernate version: 3

I have two tables: ActionBatch and Actions. ActionBatch has a numeric key, created by a generator class. That works fine. That ID then becomes the first part of the binary key for the table described below. The second field is basically the same as the batch in that it needs a generator class to populate it at save time. How do I describe such a key? In a separate class?

Mapping documents:

<class name="us.tx.state.oag.WfPersonnelAction.hbm.HbmWfPaActionTable"
table="info_wf_action">

<composite-id>
<key-property name="BatchId" column="batch_id" type="big_decimal"/>
<key-property name="ActionId" column="action_id" type="big_decimal"/>
</composite-id>

<property name="ActionTypeId" column="action_type_id" type="big_decimal" update="true" insert="true"/>
<property name="ActionTypeDesc" column="action_type_desc" type="string" update="true" insert="true"/>
<property name="Comments" column="comments" type="string" update="true" insert="true"/>

<property name="CreatedWho" column="cr_who" type="string" update="true" insert="true"/>
<property name="CreatedWhen" column="cr_when" type="timestamp" update="true" insert="true"/>
<property name="UpdatedWho" column="up_who" type="string" update="true" insert="true"/>
<property name="UpdatedWhen" column="up_when" type="timestamp" update="true" insert="true"/>
<!--
<many-to-one name="BatchId" column="batch_id" cascade="all" not-null="true" update="false" insert="false"
class="us.tx.state.oag.WfPersonnelAction.hbm.HbmWfPaActionBatchTable"/>
-->
</class>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.