-->
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: Business Key (Natural-id) and multiple persistent classes
PostPosted: Tue Aug 15, 2006 3:33 pm 
Beginner
Beginner

Joined: Tue Aug 08, 2006 11:53 am
Posts: 37
Hi all,

I've a situation where my business key is a combination of properties of two persistent entities. I am not sure how to use the "natural-id" element to group them. Following should be my business key

csaType + csaStartDate + csaEndDate + serialNumber (from Equipment.hbm.xml)

I appreciate your help. Thank you in advance!

Hibernate version: 3.x

Mapping documents:

Csa.hbm.xml

<class name="Csa" table="CSA">
<id name="id" column="CSA_ID">
<generator class="native"/>
</id>
<property name="csaType" column="CSA_TYPE" type="string" not-null="true" length="2"/>
<property name="detailedCsaType" column="CSA_TYPE_DETAIL" type="string" not-null="true" length="20"/>
<property name="startingSmu" column="STARTING_SMU" type="double" not-null="true" precision="10" scale="2"/>
<property name="smuIndicator" column="SMU_INDICATOR" type="string" not-null="true" length="2"/>
<property name="equipmentDeliveryDate" column="EQUIP_DELIVERY_DATE" type="date" not-null="true" />
<property name="csaStartDate" column="CSA_START_DATE" type="date" not-null="true" />
<property name="csaEndDate" column="CSA_END_DATE" type="date" not-null="true" />
<component name="csaSourceInfo" class="CsaSource">
<property name="dealerCode" column="DEALER_CODE" type="string" not-null="true" length="6"/>
<property name="regionCode" column="REGION_CODE" type="string" not-null="true" length="5"/>
</component>
<component name="csaAuditInfo" class="AuditInfo">
<property name="enteredDate" column="ENTERED_DATE" type="date" not-null="true" />
<property name="committer" column="COMMITTER" type="string" not-null="true" length="10"/>
<property name="modifiedDate" column="MODIFIED_DATE" type="date" not-null="true" />
</component>
<many-to-one name="equipment" class="Equipment" column="FK_EQUIP_ID" cascade="all" unique="true"/>
</class>

Equipment.hbl.xml

<class name="Equipment" table="EQUIPMENT">
<id name="id" column="EQUIP_ID">
<generator class="native" />
</id>
<property name="equipmentType" column="EQUIP_TYPE" type="string" not-null="true" length="2"/>
<property name="serialNumber" column="SERIAL_NUM" type="string" not-null="true" length="20"/>
<property name="model" column="MODEL" type="string" not-null="true" length="10"/>
<property name="industryCode" column="INDUSTRY_CODE" type="string" not-null="true" length="2"/>
<property name="mode" column="MODES" type="string" not-null="true" length="1"/>
<one-to-one name="owningCsa" class="Csa" property-ref="equipment"/>
</class>

Name and version of the database you are using:Oracle 10g


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.