-->
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.  [ 3 posts ] 
Author Message
 Post subject: additional condition within a join
PostPosted: Thu May 11, 2006 9:36 am 
Newbie

Joined: Thu Apr 20, 2006 8:26 am
Posts: 5
Hi,

I just wonder how to add a join condition within a join mapping.

Code:
<hibernate-mapping>
   <class name="VoUser" schema="org"
      table="org_vdbusers" polymorphism="explicit">

      <id name="orgaId" column="orga_id">
         <generator class="assigned" />
      </id>

      <property name="login" column="user_login" />
      <property name="password" column="user_password" />

      <join schema="org" table="v_org_contactpersons" optional="true"
         inverse="true"
cond="relationshipType=3"
Code:
>
         <key column="orga_id" on-delete="noaction" />

         <property name="orgrId" column="orgr_id" insert="false" />
         <property name="relationshipType"
            insert="false" update="false">
         </property>

         <property name="longName" column="orga_longname" />
         <property name="lastName" column="pers_lastname" />
         <property name="firstName" column="pers_firstname" />
      </join>
   </class>
</hibernate-mapping>


which should lead to something like select bla,bla,bla from org_users u join v_org_contactpersons p on (u.orga_id = p.orga_id AND relt_id = 3)


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 11, 2006 9:47 am 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
There is subselect attribute available on join element, dont know if you can use it to specify any conditions.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 11, 2006 10:06 am 
Newbie

Joined: Thu Apr 20, 2006 8:26 am
Posts: 5
I don't fully understand how subselect works, and the problem is, I would have to specify all columns seperately which I think is not an option. Also is a subselect in nearly all cases much slower than a join.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.