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?
|