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);
assertEquals(0, ((Long) (getEntityManager().createQuery(cq).getSingleResult())).intValue());
I'm sending a little maven project which reproduces the bug.
hibernate-entitymanager 3.6.0.Beta1, glassfish 3.0.1, linux ubuntu 10.04, MS SQL Server 2008
Well we still need to make sure it works for you with your db in SOME release of Hibernate. Otherwise JBoss has nothing to pull in. What Dialect do you use?
We have been using the MySQL InnoDB dialect.
hi, i created a test case that confirm that count query with EmbeddedId use all Id's in the argument. the test also do a count for a class using ClassId which create a sql that only use one Id.
I havent figured out how to fetch the sql to the test, so you have to view the log to confirm atm.
Bulk closing tickets resolved in released versions