-->
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: Composite key compounded of another composite key
PostPosted: Thu Jun 24, 2010 4:39 am 
Newbie

Joined: Mon Jun 21, 2010 3:43 am
Posts: 2
Hello,

My question is quit simple. Is it possible to create primarey key compounded itself by another composite key and a entity.

I have a table ProductHasOrder (whose pk is order+product+quantity+color), and i would like to create ProductHasOrderHasProductOptions. Then the PK of ProductHasOrderHasProductOptions should be ProductHasOrder + ProductOption

Like that :

Code:
@Entity
@Table(name="Product_has_Orders_has_ProductOption")
@AssociationOverrides({
   @AssociationOverride(name = "pk.pho.orders", joinColumns = @JoinColumn(name = "Product_has_Orders_Orders_id")),//Composite key
   @AssociationOverride(name = "pk.pho.product", joinColumns = @JoinColumn(name = "Product_has_Orders_Product_id")),//Composite key   
   @AssociationOverride(name = "pk.pho.quantityProduct", joinColumns = @JoinColumn(name = "Product_has_Orders_quantityProduct")),//Composite key
   @AssociationOverride(name = "pk.pho.color", joinColumns = @JoinColumn(name = "Product_has_Orders_color")),//Composite key
   @AssociationOverride(name = "pk.productOption", joinColumns = @JoinColumn(name = "ProductOption_id"))//Other entity
   })


The error i obtain is a wrong column name.

Code:
Unknown column 'options0_.pho_Orders_id' in 'field list'


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.