[Hibernate-JIRA] Commented: (HHH-1673) hql parsed with exception (with clause)
by Trygve Hardersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1673?page=c... ]
Trygve Hardersen commented on HHH-1673:
---------------------------------------
I had a similar issue where a left join would reference a column from a previous left join in the "with" clause. The SQL for this works on MySQL at least, but Hibernate gave me the "with-clause referenced two different from-clause elements" error.
I checked our the 3.3.2.GA tag source and managed to build it locally. I then commented our line 447 org.hibernate.hql.ast.HqlSqlWalker where the exception is thrown, and Hibernate is now generating the correct SQL for me without complaining. I'm not sure which implications this can have, but any queries that reached that point in the code would have resulted in an exception being thrown anyway. I guess Hibernate may generate invalid queries in some cases.
> hql parsed with exception (with clause)
> ---------------------------------------
>
> Key: HHH-1673
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1673
> Project: Hibernate Core
> Issue Type: Deprecation
> Components: query-hql
> Affects Versions: 3.1.3
> Reporter: Tomasz Bech
> Attachments: HHH-1673.patch, HHH-1673.patch
>
>
> The 'improvement' bug fix: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1520
> has broken working functionality:
> I found that after switching to 3.1.3 following construction is not working any longer:
> (FootnoteTypeBO has collection 'descriptions' and reference to languageBO)
> from FootnoteTypeBO as o
> left outer join o.descriptions as t1
> with (t1.language in (select loid from LanguageBO where name = 'aa'))
> --> exception: 'with-clause referenced two different from-clause elements'.
> There is no implicit join as dewscribed in main anomaly, so it shouldn't cause the problem. So now there is no way to write correct hql/sql, and I don't see any workaround.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1615) GROUP BY entity does not work
by Rafael Santini (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1615?page=c... ]
Rafael Santini commented on HHH-1615:
-------------------------------------
I also ran into this problem with SQL Server. With MySQL the same query works.
HQL:
select count(emprestimo.exemplar.obra), emprestimo.exemplar.obra from Emprestimo emprestimo where emprestimo.data between ? and ? group by emprestimo.exemplar.obra order by count(emprestimo.exemplar.obra) desc
SQL generated:
select count(exemplar1_.id_obra) as col_0_0_, exemplar1_.id_obra as col_1_0_, obra2_.id as id157_, obra2_.mfn as mfn157_, obra2_.titulo as titulo157_, obra2_.localizacao as localiza4_157_, obra2_.id_idioma as id5_157_, obra2_.id_tipo_obra as id6_157_, obra2_.id_categoria_obra as id7_157_, obra2_.id_area_obra as id8_157_, obra2_.id_base as id9_157_ from bs_emp_mov_emprestimo emprestimo0_, bs_emp_ace_exemplar exemplar1_, bs_emp_ace_obra obra2_ where emprestimo0_.id_exemplar=exemplar1_.id and exemplar1_.id_obra=obra2_.id and (emprestimo0_.data between ? and ?) group by exemplar1_.id_obra order by count(exemplar1_.id_obra) desc
Error:
A coluna 'bs_emp_ace_obra.ID' é inválida na lista de seleção porque não está contida em uma função agregada nem na cláusula GROUP BY.
> GROUP BY entity does not work
> -----------------------------
>
> Key: HHH-1615
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1615
> Project: Hibernate Core
> Issue Type: Improvement
> Components: query-hql
> Affects Versions: 3.2.5
> Environment: PostgreSQL 8.1.3, Hibernate 3.1.3
> Reporter: Xavier Bugaud
> Assignee: Anthony Patricio
> Priority: Critical
> Attachments: group-by-discriminator.patch, hibernate-group-by.diff
>
>
> The query : "select cat, count(*) from Cat cat group by cat" does not work.
> ERROR: column "xxxx" must appear in the GROUP BY clause or be used in an aggregate function
> See :
> - http://forum.hibernate.org/viewtopic.php?t=953716
> - http://jira.nhibernate.org/browse/NH-528
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 5 months