-->
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.  [ 2 posts ] 
Author Message
 Post subject: HQL - Native SQL subqueries
PostPosted: Tue Feb 10, 2009 5:16 pm 
Newbie

Joined: Tue Feb 10, 2009 5:09 pm
Posts: 1
Hi!

I'm trying to write a query in Hibernate using native SQL that contains a subselect..the simplified version of the query looks something like:

Code:
select u.first_name, u.last_name, u.username,

(select balance from account_info
where account_fk = u.account_pk
and (date_start <= '2009-2-1' or date_end > '2009-2-1') as balance

from user u

order by username 


when I run this query using

Code:
Query query = session.createSQLQuery(query);
this.setResults(query.list());


I get the following error: Column '' not found.

Can anyone tell me why hibernate does not like this?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2009 5:20 pm 
Newbie

Joined: Fri Jan 30, 2009 5:08 pm
Posts: 17
Location: Florida
What does the schema look like and can you show the code?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.