-->
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: [Migration 2.8 -> 3.1] Join problems
PostPosted: Tue Jul 18, 2006 6:20 am 
Newbie

Joined: Mon May 29, 2006 5:20 am
Posts: 5
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.


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.