]
Sami Dalouche commented on HHH-2787:
------------------------------------
mmh, forget what I said about the work around... this is a work around for another bug I
reported against the criteria API... (yeah..)
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: Hibernate Core
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: