-->
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: Two aliases for a table in a single query
PostPosted: Fri Feb 22, 2008 9:03 am 
Beginner
Beginner

Joined: Thu Jun 29, 2006 8:41 am
Posts: 41
Hibernate version: 3.1

Name and version of the database you are using: Oracle 10g

We use Hibernate in our application and now we need to cross data from a table with itself. In other words, we need to do queries that support multiple aliases for a single class, as the following exemple:

"select classAA.classB.seq and classAA.classB.data from ClassA classAA, ClassA classAB, ClassB classB where classAB.classB.data = ..."

Anyway, the example isn't meant to be a real query but it's meant to demonstrate that we both need to adress the problem of two or more aliases for a single table in a single query and the one-to-many relation between some classes.

We belive that HQL doesn't support multiple aliases for a table in a query and we tried to use SQL with hibernate, but unless we use pure SQL the query won't work.

Whenever I try to use the Hibernate Placeholders inside the SQL I get either StackOverflowErrors or errors indicating that no properties classB.seq exist for table with alias classAA.

So, I really need ideas on how to resolve this problem.

_________________
Falci - Heavy Worker!


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.