-->
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: multiple outer join condition
PostPosted: Mon Aug 23, 2004 8:09 am 
Newbie

Joined: Mon Aug 23, 2004 7:54 am
Posts: 15
I'm using [b]Hibernate 2.1.4[/b] and here is a fragment of my mapping file:

[b]
<class name="beans.Model" table="Models">
<id name="id" column="kmodel" type="integer">
<generator class="sequence">
<param name="sequence">gen_kmodel</param>
</generator>
</id>
<property name="name" column="name" type="string" not-null="true" />
<set name="cheltuieli">
<key column="fkmodel"/>
<one-to-many class="beans.Cheltuiala"/>
</set>
</class>

<class name="beans.Cheltuiala" table="Cheltuieli">
<id name="id" column="kcheltuiala" type="integer">
<generator class="sequence">
<param name="sequence">gen_kcheltuiala</param>
</generator>
</id>
<property name="fkmodel" column="fkmodel" type="integer"/>
<property name="suma" column="suma" type="long"/>
[/b]

[b]I'm using firebird 1.5.0[/b]

If i use something like

select model.id, ch.suma
from beans.Model model
left outer join model.cheltuieli ch
where ch.suma > 10

everything works as it should. It generates:

select model0_.id, cheltuieli1_.suma
from Modele model0_
left outer join Cheltuieli cheltuieli1_ on
model0_.kmodel=cheltuieli1_.fkmodel
where cheltuieli1_.suma > 10

The [b]problem [/b] is that I want to obtain something like this:

select model0_.id, cheltuieli1_.suma
from Modele model0_
left outer join Cheltuieli cheltuieli1_ on
model0_.kmodel=cheltuieli1_.fkmodel
and cheltuieli1_.suma > 10

How can I do this? [/b]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 23, 2004 10:14 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
You cannot specify additional join conditions (Hibernate uses IDs specified in the association mappings).

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 24, 2004 2:43 am 
Newbie

Joined: Mon Aug 23, 2004 7:54 am
Posts: 15
The problem is that one of the properties of a bean is calculated automaticaly from the values of other properties, and isn't mapped to a real column. Thus I can't use native SQL :(


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.