Hi.
I'm migrating from Hibernate 2.8 to Hibernate 3.1
I had an HQL query which worked fine in the 2.8 version :
SELECT a, b FROM A.class a, B.class b WHERE a.id = b.foreignKeyA (+);
My mapping is the following
A.hbm.xml
<hibernate-mapping>
<class name="com.A" table="TABLE_A">
<id column="ID" name="id" type="long">
<generator class="sequence">
<param name="sequence">S_A</param>
</generator>
</id>
</class>
</hibernate-mapping>
B.hbm.xml
<hibernate-mapping>
<class name="com.B" table="TABLE_B">
<id column="ID" name="id" type="long">
<generator class="sequence">
<param name="sequence">S_B</param>
</generator>
</id>
<property column="FOREIGN_KEY_A" name="foreignKeyA " not-null="true" type="long" length="10" />
</class>
</hibernate-mapping>
It seems that hibernate 3.x does not accept the (+) syntax any more.
I'd rather not change the mapping.
Although I need to do a left join on B table.
The only way I found is to use NativeSql :
SELECT A.*, B.* FROM A, B WHERE A.ID=B.FOREIGN_KEY_A (+)
(It could also be
SELECT A.*, B.* FROM A LEFT JOIN B ON A.ID=B.FOREING_KEY_A)
Is there a way to generate the same SQL from a HQL query without modifying my mapping ?
Thanks for any help.
|