2

I've some problem with HQL query. I would use subquery with alias like this

    select distinct a.some1, count(a.some2), 
           (Select count(z.any), z.any.any_id as v from Z z where
            z.level=4) as "zoo", azc.a.any_id 
            from A a 
            where a.z.level=4
            zoo.v=a.z.m

but alias return me a error. Where is the problem?

Claudio Pomo
  • 2,392
  • 7
  • 42
  • 71

2 Answers2

2

HQL not supporting alise for column in select clause,

but there is one Unresolved jira issue, give look at Jira Link

this capability is planned to be added as a new feature in the future.

swapy
  • 1,616
  • 1
  • 15
  • 31
1

Well, first of all, you can't use double quotes to define an alias ("zoo" --> zoo).

Second, you're using an alias which as not been defined: azc.

Third, your where clause is wrong: you forgot an and or an or betwwen the two restrictions.

I'm not absolutely sure your query will be correct after you fix all these errors, but you should at least start with that. And please, join the error message and the full stack trace of any exception you have.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255