-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to join the same association twice?
PostPosted: Thu Feb 19, 2015 12:06 pm 
Newbie

Joined: Sat Sep 18, 2010 3:16 am
Posts: 5
Hi all,
I'm looking for a suitable approach to join the same association twice with Hibernate Critera.

In this case I’d like to join entity B twice with entity A.
B is a OneToMany-Set in A.

The pure SQL-Statement looks like this:
Code:
SELECT
   a.id,
   b1.attribute1
   b2.attribute2
FROM
   A AS a
   INNER JOIN B AS b1 ON a.id = b1.a_id
   INNER JOIN B AS b2 ON a.id = b2.a_id

Is there anybody who could help?
Thanks in advance,
janpaet


Top
 Profile  
 
 Post subject: Re: How to join the same association twice?
PostPosted: Thu Mar 05, 2015 6:28 am 
Newbie

Joined: Thu Mar 05, 2015 6:10 am
Posts: 1
Hello,
did you solve your problem?
I'm trying to do the something similar

Code:
SELECT l1
  FROM lezioni l1
   INNER JOIN lezioni l2
     ON  l1.aulas = l2.aulas
     AND l1.IDLezione <> l2.IDLezione
     AND l1.Start >= l2.End
     AND l1.End <= l2.Start
Where l1.Start>:from AND l1.End<:to


Thanks


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