[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4012) Part of Composite-Id is foreign Key:How specify in Mapping?

Sandeep Vaid (JIRA) noreply at atlassian.com
Fri Jul 3 07:44:15 EDT 2009


Part of Composite-Id is foreign Key:How specify in Mapping?
-----------------------------------------------------------

                 Key: HHH-4012
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4012
             Project: Hibernate Core
          Issue Type: Improvement
          Components: core
    Affects Versions: 3.3.2
            Reporter: Sandeep Vaid
            Priority: Critical


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list