[jboss-jira] [JBoss JIRA] (HIBERNATE-117) Part of Composite-Id is foreign Key:How specify in Mapping?

Steve Ebersole (JIRA) issues at jboss.org
Thu Nov 19 10:33:00 EST 2015


    [ https://issues.jboss.org/browse/HIBERNATE-117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13130921#comment-13130921 ] 

Steve Ebersole commented on HIBERNATE-117:
------------------------------------------

This is an issue tracker for reporting issues, not a help forum.  If you need help using Hibernate please use its forums, irc or StackOverflow.  Thanks.


> Part of Composite-Id is foreign Key:How specify in Mapping?
> -----------------------------------------------------------
>
>                 Key: HIBERNATE-117
>                 URL: https://issues.jboss.org/browse/HIBERNATE-117
>             Project: Hibernate Integration
>          Issue Type: Feature Request
>            Reporter: Sandeep Vaid
>            Assignee: Steve Ebersole
>
>  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 was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list