[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2787) Criteria Aggregate Projections do not JOIN additional tables on which restrictions apply

Matija Mazi (JIRA) noreply at atlassian.com
Mon Aug 4 04:55:31 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_30802 ] 

Matija Mazi commented on HHH-2787:
----------------------------------

This happens with MS SQL Server too.

> 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list