[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5093?page=c...
]
Jesper Steen Møller commented on HHH-5093:
------------------------------------------
FWIW, I tried adding this test case in
org.hibernate.ejb.criteria.basic.BasicCriteriaUsageTest under 3.5.1:
public void testCountWalls()
{
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
CriteriaBuilder cb= em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Wall> u = cq.from(Wall.class);
cq.select(cb.count(u));
em.createQuery( cq ).getSingleResult();
// We are checking for bad SQL here!
em.getTransaction().commit();
em.close();
}
This was in the Hibernate tests, running against HSQL.
Worked just fine, the generated SQL was:
select
top ? count(wall0_.id) as col_0_0_
from
crit_basic_wall wall0_
CriteriaQuery using count leads to wrong query
----------------------------------------------
Key: HHH-5093
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5093
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.0-Final
Reporter: Frederic Müller
Using "query.select(cb.count(root));" we get a query like this:
select count() from test.Entity as generatedAlias0 left join generatedAlias0.message as
generatedAlias1
Tried almost everything but this problem doesn't seem to have been addressed for
quite some time now.
Seems like some other people still have the same problem and yet nobody seems to bother.
https://forum.hibernate.org/viewtopic.php?p=2428452
--
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