-->
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: Using <join> to distribute properties to multiple tabl
PostPosted: Wed Aug 22, 2007 6:11 am 
Newbie

Joined: Wed Aug 22, 2007 5:33 am
Posts: 1
I have a class user that needs to map its properties to 2 legacy tables. This scenario is well documented and an example exists in the caveatemptor application.
But I experience a problem with an invalid SQL statement generated for joining the 2 tables:

The tables (Oracle - can't be modfied!!) are:

BENUTZER (PERS_LOG:VARCHAR2, PERS_NO:NUMBER, PERS_PW:VARCHAR2) PERS_LOG primary key

PERSON (PERS_NO:NUMBER, PERS_VNA:VARCHAR2, PERS_NNA:VARCHAR2) PERS_NO primary key

These two tables are mapped into a single class using the following mapping definition:

Code:
   <class name="SimpleUser" table="BENUTZER">
      <id name="login" column="PERS_LOG"></id>

      <property name="password" column="PERS_PW" insert="false" update="false"></property>
      <join table="PERSON">
         <key column="PERS_NO" foreign-key="PERS_NO"/>

         <property name="firstName" column="PERS_VNA"></property>
         <property name="lastName" column="PERS_NNA"></property>

      </join>
   </class>



when running a test the following invalid SQL is created:

Code:
select this_.PERS_LOG as PERS1_3_0_, this_.PERS_PW as PERS2_3_0_, this_1_.PERS_VNA as PERS2_4_0_, this_1_.PERS_NNA as PERS3_4_0_ from BENUTZER this_ inner join PERSON this_1_ on this_.PERS_LOG=this_1_.PERS_NO where (1=1)]


As you see it tries to join trough this_.PERS_LOG=this_1_.PERS_NO. The correct condition should be this_.PERS_NO=this_1_.PERS_NO!!

I have tried this with hibernate-core-3.2.3 and the latest 3.2.5 version!

I would be happy if anybody could guide me here!
Thanks Martin


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.