-->
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: Needed information @ a support for given SQL in HQL
PostPosted: Mon Jul 10, 2006 6:44 am 
Regular
Regular

Joined: Mon May 08, 2006 6:00 am
Posts: 53
Location: India
Hi, needed one information @ a support for following SQL in HQL,

I am not able to get following HQL working , any clue whether following syntax is supported

select count(*) from (select * from table)

Above statement is a valid SQL, but when i translated it to HQL and try running it I am getting query syntax exception

FYI, I am using oracle9dialect

Any clue please

Thanks and Regards,

Sudhir


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 10, 2006 7:30 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Quote:
select count(*) from (select * from table)


Could you explain a bit what you are trying to do ? Do you want to count the number of lines inside many tables ? This query seems a bit weird to me, maybe you're trying to write a dbms admin tool with Hibernate ?

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 10, 2006 7:40 am 
Regular
Regular

Joined: Mon May 08, 2006 6:00 am
Posts: 53
Location: India
Ok let me explain ones again

I have following sql

select count(*) from (
select id, name from usertable
)

this query runs absolutely fine on SQL

when i convert this SQL to HQL and execute as shown below, i get a error on "(" which is after keyword "from"

select count(*) from (
select intId, strName from usertableObj
)


therefore i asked whether same syntax is supported in HQL


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 10, 2006 7:58 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Well, I don't think HQL is designed to do it. IMO, this is typically the kind of things that could be done with createSQLQuery() instead of createQuery().

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


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.