-->
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: Implicit join generates "cross join" in SQL
PostPosted: Wed Jun 22, 2011 11:47 am 
Newbie

Joined: Wed Jun 22, 2011 11:37 am
Posts: 4
Quoting from Hibernate documentation, 14.4 Forms of join syntax:
"The implicit form does not use the join keyword. Instead, the associations are "dereferenced" using dot-notation. implicit joins can appear in any of the HQL clauses. implicit join result in inner joins in the resulting SQL statement. "

However, when I use something like this:
SELECT COUNT DISTINCT A.id from A where A.B.C.id=1;
in generates
select count(distinct a.id) from tbl_a a cross join tbl_b b where a.b_id=b.id and b.c_id=1;

Mapping:
<class name="A" table="tbl_A" >
<id name="id">
<generator class="native"/>
</id>

<many-to-one name="B" column="b_id"/>
</class>

<class name="B" table="tbl_B" >
<id name="id">
<generator class="native"/>
</id>

<many-to-one name="C" column="c_id"/>
</class>

Can I convince Hibernate to generate a "inner join" instead of a "cross join" and still using implicit join?


Top
 Profile  
 
 Post subject: Re: Implicit join generates "cross join" in SQL
PostPosted: Mon Apr 30, 2012 8:36 am 
Newbie

Joined: Mon Apr 30, 2012 8:32 am
Posts: 1
Have you resolved your issue?


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.