-->
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: Join through a translator id table
PostPosted: Mon Jan 08, 2007 8:01 am 
Newbie

Joined: Mon Jan 08, 2007 7:38 am
Posts: 1
I have a crossing table that translate some data through 2 different DB

In the first DB i have a table

tableA
----------------
id_userA
city_code
(other not important field)

In the second DB the city code is structured in a different mode

tableB
----------------
id_userB
city_cod1
city_cod2
city_cod3
(other not important field)


The anagraphic of the cities is in the first DB so I created a translation table that match the 3 codes of the second DB to the code of the first DB

translate_table
----------------
city_code (PK)
city_cod1
city_cod2
city_cod3

city_cod1, city_cod2, city_cod3 as an index (unique)

This table makes only a translation of the coding between the two different DB

I tryed different configuration like

in tableB .hbm.xml

<property name="cityCod1" type="java.lang.String" column="city_cod1" length="3" />
<property name="cityCod2" type="java.lang.String" column="city_cod2" length="3" />
<property name="cityCod3" type="java.lang.String" column="city_cod3" length="3" />

<properties name="codB">
<property name="cityCod1" column="city_cod1" insert="false" update="false"/>
<property name="cityCod2" column="city_cod2" insert="false" update="false"/>
<property name="cityCod3" column="city_cod3" insert="false" update="false"/>
</properties>

<join table="translate_table">
<key property-ref="codB" not-null="true" >
<column name="city_cod1" />
<column name="city_cod2" />
<column name="city_cod3" />
</key>
<many-to-one name="tableA" class="tableA" not-null="true" column="city_code" />
</join>

but i have this error

Configuration problem: Foreign key (FKABD26E567A5262DA:translate_table [city_cod1,city_cod2,city_cod3])) must have same number of columns as the referenced primary key (tableB [id_userB])

How i can modelling this Database structure

Thanx Ivan


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.