-->
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: problem joining two tables with a one-to-many relationship
PostPosted: Fri May 19, 2006 5:39 pm 
Newbie

Joined: Thu Aug 04, 2005 6:14 pm
Posts: 16
Hi all,

I have to map table from a legacy system and facing one of these foreign keys issues where I couldn't find a solution for yet.

This is the error message I get:
Foreign key (FKED8DCCEF19BE1B58:product [productid])) must have same number of columns as the referenced primary key (countrystoreproduct [productId,country_id,store_id])

The class setup is as follows:
Class A is primary mapped to a table T1 that has a composite-id which consists of three columns.

Inside this mapping I am trying to join a second table T2 which has a single column as primary key. This column is a reference to one of T1s key columnes.

So basically I'm having a one-to-many relationship between T2 and T1. The problem is that I don't want to create seperate classes for both tables. As mentioned earlier I would rather like to join information from T2 into the mapping of T1.

I tried using a property-ref in the join key but hibernate doesn't seem to care about this (using properties with different number of columns than the primary key does work when used inside a <map> but somwhow not in a join.)


Does anybody have an idea how I could solve this or do I have to go with the many-to-one reference from T2 to T1 and add an extra class?

Thanks alot!
T.

PS: I'm using Hibernate version 3.1.3


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.