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
|