[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2787?page=c...
]
Sami Dalouche updated HHH-2787:
-------------------------------
Attachment: hibernateBug.tar.gz
There are 5 Beans : Entity1, Entity2, Entity3, Entity4 and Component1, and the mapping is
expressed as @Annotations.
The test case is HibernateBugTest.java, which calls HibernateBugDao (injected through
Spring on my setup).
This reproduces the problem.
Criteria Aggregate Projections do not JOIN additional tables on which
restrictions apply
----------------------------------------------------------------------------------------
Key: HHH-2787
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2787
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.5
Environment: PostgreSQL Dialect
Reporter: Sami Dalouche
Priority: Critical
Attachments: hibernateBug.tar.gz
Hi,
When you have a Criteria Object, on which you :
- Add Aggregate Projections such as rowCount()
- createAlias("whatever").add(Restrictions.*..)
It looks like that the "whatever" table is NOT joined, even though it is joined
OK when the projections are not there.
So, here is an approximate Unit test that should throw an exception (I couldn't
create a complete test case since I couldn't get the unit tests to run on my machine
-any link explaining this step somewhere ?):
Criteria c1 = s.createCriteria(Enrolment.class)
.setProjection( Projections.projectionList().add(Projections.rowCount(),
"rowCount") );
Criteria studentCriteria = c1.createAlias("student", "st");
studentCriteria.add(Restrictions.eq("name", "whatevername"));
It should complain saying the "st.name" alias does not exist, because the
student class has not been joined.
Regards,
Sami Dalouche
--
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