-->
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: many-to-one association mapping with formula
PostPosted: Mon Dec 22, 2008 5:27 am 
Newbie

Joined: Tue Aug 29, 2006 10:56 am
Posts: 15
Hi,

i have an advanced many-to-one association with a formula.

hbm mapping table1:
Code:
...
<many-to-one name="wp" class="myclass.Table2"  property-ref="myJoin"  insert="false" update="false" lazy="false" not-found="ignore">
    <formula>'PDI'</formula>
    <column name="ID"/>         
</many-to-one>
...


hbm mapping table2:

Code:
PK(ID)

...
<properties name="myJoin" update="false" insert="false">
         
   <property name="type" type="string" update="false" insert="false" >
      <column name="MY_TYPE" />
   </property>

   <property name="id2" type="big_integer" update="false" insert="false">
      <column name="ID" />
   </property>
...


The generated sql:

Code:
select
...
FROM
    table1 this_
LEFT OUTER JOIN
    table2 table2_
    ON
    'PDI' = table2_.MY_TYPE
    AND this_.ID = table2_.ID
    AND table2_.MY_TYPE= 'PDI'
WHERE   
...


Why is in the join condition the additional expression:

AND table2_.MY_TYPE= 'PDI' ? I have expected only the expression: 'PDI' = table2_.MY_TYPE

Regards!


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.