DZone Forums
Go Back   DZone Forums > Community > Languages & Frameworks > Java
Reload this Page Part of Composite-Id is foreign Key:How specify in Mapping?
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Mar 2009
Default Part of Composite-Id is foreign Key:How specify in Mapping? - 07-03-2009, 07:44 AM

I have 2 classes viz. Product and ProductBasic having one-to-one relationship

class Product{
String productId;
ProductBasic productBasic;
}

class ProductBasic{
String productId;
String useCode;
TimeStamp startTime;

Product product;
}

Product is mapped to a table PRODUCT which has PRODUCTID as PK.
ProductBasic is mapped to a table PRODUCTBASIC which has PRODUCTID,USECODE and STARTTTIME as composite key.
Also PRODUCTID (of PRODUCTBASIC table) is the foreign key referencing PRODUCT table...

How can i define my one-to-one mapping considering ProductBasic.productId should get its value from Product.productId ?


<composite-id>
<key-property name="productId" column="PRODUCTID" type="string" length="10" />
<key-property name="useCode" column="USECODE" type="string" length="10" />
<key-property name="startTime" column="STARTTIME" />
<composite-id>

In this only productId is the foreign key..

I am aware that i can use a <generator> tag (with class="foreign") inside <composite-id> but i guess it will generate the
value for entire composite-id and not just a field of it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preserving uuid to xmi:id mapping converting uml2 to eCore pierospinelli Eclipse 0 05-18-2009 04:07 AM
Specify relationship in mapping using some condition not just id's. CatchSandeepVaid Java 1 04-27-2009 11:50 AM
Creating an SWT Scrolled Composite alwillms Eclipse 0 02-27-2009 06:04 PM
Embed JPanel in a Composite bitrider Eclipse 0 09-24-2008 05:53 AM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com