[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4013) One-to-one:property-ref to a part of composite-key
Sandeep Vaid (JIRA)
noreply at atlassian.com
Mon Jul 6 01:40:12 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33534#action_33534 ]
Sandeep Vaid commented on HHH-4013:
-----------------------------------
I have combined this issue and few of my previous issues to a new single and better improvement request.
The new single improvement request is at :
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4014
I don't have rights to delete this issue request. Please make this issue (HHH-4013) closed. Please consider HHH-4014 as its a sure stopper.
> One-to-one:property-ref to a part of composite-key
> --------------------------------------------------
>
> Key: HHH-4013
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4013
> Project: Hibernate Core
> Issue Type: Improvement
> Reporter: Sandeep Vaid
>
> I have 2 classes viz. Product and ProductBasic having one-to-one relationship
> 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.
>
> My database is legacy and i cannot change it.
> I get the one-to-one relationship by applying the condition as:
> PRODUCT.PRODUCTID=PRODUCTBASIC.PRODUCTID and USECODE='008' and STARTTIME < CURRENTIME < ENDTIME..
> My database values are such that if i apply this condition i will only get once record..
>
> In Product.hbm.xml:
> <class name="Product" table="PRODUCT"
> <id name="pid" type="string" column="PRODUCTID" length="10">
> <generator class="assigned"></generator>
> </id>
>
> <one-to-one name="productBasic" class="ProductBasic" constrained="true" outer-join="false" cascade="save-update" property-ref="activeProductBasic" >
> <formula>PRODUCTID</formula>
> </one-to-one>
> </class>
>
>
> In ProductBasic.hbm.xml
>
> <class name="ProductBasic" table="PRODUCTBASIC">
> <composite-id name="compProductBasic" class="CompProductRelatedAssociations">
> <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" type="timestamp"/>
> </composite-id>
>
> <properties name="activeProductBasic">
> <property name="compProductBasic.productId" column="PRODUCTID" type="string" length="10" insert="false" update="false"/>
> </properties>
> </class>
>
> but this compProductBasic.productId is giving me error...
--
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