-->
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.  [ 4 posts ] 
Author Message
 Post subject: Implementing the "from (select..." statement in HQ
PostPosted: Fri Feb 27, 2004 6:48 am 
Newbie

Joined: Fri Feb 20, 2004 10:59 am
Posts: 13
Location: Italy
Hi all,

I'm trying to implement an Oracle query containing the pattern "select ... from (select ... from...) ... " in HQL. As a simple example I would like to run the following Oracle query:

select * from (select name, age from customer)

I know that the query is nonsense, nevertheless I would like to make it work in hibernate just to verify if a such statement is supported by HQL.
Can anyone provide the equivalent HQL query?

Thanks.

Best regards.
Dario.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 7:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No, this is not supported, don't think it would make much sense on an object querying level. You can use createSqlQuery to roll your own.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 4:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yeah, AFAICT, from-clause subselects don't make sense in an OO query language, so you would be better to just use direct JDBC.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 12:12 pm 
Newbie

Joined: Fri Feb 20, 2004 10:59 am
Posts: 13
Location: Italy
gavin wrote:
Yeah, AFAICT, from-clause subselects don't make sense in an OO query language, so you would be better to just use direct JDBC.


Ok, I implemented the query using the createSQLQuery() method and works fine. However I'm a little bit disappointed I can't use HQL: using regular SQL my query could become vendor dependent :-(
I don't know much about OO query language, so I don't catch your observation. In SQL such queries are often useful for performance reason, when you want to manipulate columns from different tables in a single select and would be too expensive to join all the tables. You mean that in OO queries this situation never occurs, or is there a different solution?

Dario


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.