]
Steve Ebersole updated HHH-5419:
--------------------------------
Priority: Minor (was: Major)
Out of curiosity what is the "bad SQL"?
COUNT operator with composite primary key and JPA 2.0 Criteria API
produces bad sql
-----------------------------------------------------------------------------------
Key: HHH-5419
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5419
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.6.0.Beta1
Environment: hibernate-entitymanager 3.6.0.Beta1, glassfish 3.0.1, linux ubuntu
10.04, MS SQL Server 2008
Reporter: Fabio Braga de Oliveira
Priority: Minor
Attachments: hibernate-count-bug.zip
Hibernate produces a invalid SQL if anyone use the count() operator with the JPA 2.0
Criteria API. Code:
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
CriteriaQuery<Object[]> cq = cb.createQuery(Object[].class);
Root<EntityCompositePK> r = cq.from(EntityCompositePK.class);
cq.multiselect(cb.count(r));
assertEquals(0, ((Long)
(getEntityManager().createQuery(cq).getSingleResult())[0]).intValue());
I'm sending a little maven project which reproduces the bug.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: