-->
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: one-to-one with one column of a composite id
PostPosted: Tue Oct 10, 2006 2:41 pm 
Newbie

Joined: Tue Sep 19, 2006 7:07 pm
Posts: 9
I've a class item with a composite id who have a relationship with concreto. Only one column of id have relationship with concreto. The other column of id is relatred with another table.

TABLE Concreto
CODIGO_CONC NUMBER(6,0) NOT NULL,
...
PRIMARY KEY ( CODIGO_CONC )

TABLE item_compra
CODIGO_CONC NUMBER(6,0) NOT NULL,
CODIGO_COMP NUMBER(6,0) NOT NULL
...
PRIMARY KEY ( CODIGO_CONC, CODIGO_COMP )
FOREIGN KEY ( CODIGO_CONC ) REFERENCES concreto ( CODIGO_CONC )
FOREIGN KEY ( CODIGO_COMP ) REFERENCES compra ( CODIGO_COMP )
);

the map file is:

<composite-id name="Item_CompraPK" class="Item_CompraPK">
<key-property name="codigoConc" column="Codigo_Conc" type="Int"/>
<key-property name="codigoComp" column="Codigo_Comp" type="Int"/>
</composite-id>

<one-to-one name="concreto" class="exemplo.Concreto"/>

I'm receiving the follow erro:

broken column mapping for: concreto.id of: Item_Compra...

I believe the problem is that hibernate try to get concreto based on the two columns of composite id. It's should be done with just the Codigo_Conc column that is the relationship column between concreto and item.
How can I fix the problem? How can I map a one-to-one relationship based in just one of the columns of a composite id?


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.