-->
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.  [ 5 posts ] 
Author Message
 Post subject: condition on outer join
PostPosted: Tue May 30, 2006 4:18 pm 
Beginner
Beginner

Joined: Fri May 26, 2006 7:15 am
Posts: 20
Location: Vandavasi, TamilNadu
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1

Hi,

I have problem in executing the qry with condition on outer join.
Below is the qry i am trying to execute. Getting error in 3rd line.

from table1 as tbl1
inner join t1.table2 as tbl2
left outer join tbl1.table3 as tbl3 with (tbl3.dt=12 and tbl2.cd=abc)


[without tbl2 properties, its working]

Any help/suggestions/alternate ways needed seriously.


Thanks
gajini


Top
 Profile  
 
 Post subject: Re: condition on outer join
PostPosted: Tue May 30, 2006 5:45 pm 
Regular
Regular

Joined: Thu Sep 22, 2005 1:53 pm
Posts: 88
Location: Rio de Janeiro
gajini wrote:


from table1 as tbl1
inner join t1.table2 as tbl2
left outer join tbl1.table3 as tbl3 with (tbl3.dt=12 and tbl2.cd=abc)



Shouldn´t this be:

Code:

from table1 as tbl1
inner join tbl1.table2 as tbl2 WITH (tbl2.cd='abc')
left outer join tbl1.table3 as tbl3 with (tbl3.dt=12)



changed t1 to tbl1 and with to table 2
maybe.....??????

_________________
Don´t forget to rate!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 3:29 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
When you upgrade your hibernate version (3.1.2 or greater) you will need something like:
Code:
from
   table1 as tbl1
   inner join tbl1.table2 as tbl2
   left outer join tbl1.table3 as tbl3
      with tbl3.dt = 12
where
   tbl3 is null
   or
   tbl2.cd = abc


Top
 Profile  
 
 Post subject: condition on outer join(with and,or)
PostPosted: Wed May 31, 2006 10:27 am 
Beginner
Beginner

Joined: Fri May 26, 2006 7:15 am
Posts: 20
Location: Vandavasi, TamilNadu
ok, let's have this qry. how to do this ?

from table1 as tbl1
inner join tbl1.table2 as tbl2
left outer join tbl1.table3 as tbl3 with ((tbl3.dt=12 and tbl2.cd=abc) or (tbl3.dt=13 and tbl2.cd<>abc))

_________________
gajini
------------------


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 6:35 pm 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
Code:
from
   table1 as tbl1
   inner join tbl1.table2 as tbl2
   left outer join tbl1.table3 as tbl3
where
   tbl3 is null
   or
   (tbl3.dt = 12 and tbl2.cd = abc) or (tbl3.dt = 13 and tbl2.cd <> abc)

does it works?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.