-->
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: multiple inner joins with the same Object in HQL
PostPosted: Mon Oct 30, 2006 8:16 pm 
Newbie

Joined: Sun Oct 22, 2006 11:28 am
Posts: 15
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

3.2 final

Mapping documents:

N/A

Code between sessionFactory.openSession() and session.close():

N/A

Full stack trace of any exception that occurs:

N/A

Name and version of the database you are using:

MySQL 5.0.20

Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Hi All,

I have read all the docs and HQL examples, but can't find any that offer a solution to my problem.

I'm using HQL, and I want to do multiple inner joins on the same object, but I want the result to be an or condition. For example, in regular SQL the equivalent of:

select distinct m.* from
message m
inner join ( message_addressing_brand mab, message_addressing_location mal, message_addressing_role mar, message_addressing_user mau )
on ( m.id=mab.message_id or m.id=mal.message_id or m.id=mar.message_id or m.id=mau.message_id)

If I try the following in HQL:

select distinct m from message m inner join m.brands inner join m.users inner join m.roles inner join m.locations it returns 0 rows because it is effectively 'anding' the conditions.


Thanks in advance,
Ian


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.