[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-530) Allow application of filters on subqueries

Shawn Clowater (JIRA) noreply at atlassian.com
Thu Mar 13 11:04:33 EDT 2008


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

Shawn Clowater commented on HHH-530:
------------------------------------

Just included a patch that should allow the 4th test from October to now pass.  The original issue that was happening was with the CriteriaImpl that was being stored in the SubqueryExpression and the recursive nature of the toSqlString method.

When the Subquery is built up you pass in a DetachedCriteria and that is stored in the CriteriaImpl parameter.  When the query is executed, the first pass to the toSql string is the main executable criteria you are running that already has the session set on it which you can pull off and grab the enabledFilters.  However, when it recurses it passes in the stored CriteriaImpl(DetachedCriteria) that doesn't have a session.  All the new patch does is set the session of the Criteria coming in onto the CriteriaImpl.  As the call recurses the session gets passed along and you can get at the filters.

I'm not sure why I didn't see this before but it took me about 5 minutes to spot it after a co-worker was attempting a nested subquery yesterday.  It seems like a relatively safe way to go.  If someone could approve/disapprove/suggest refinements I'd love to get this tied off as it's been outstanding for almost 2 years now.

> Allow application of filters on subqueries
> ------------------------------------------
>
>                 Key: HHH-530
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-530
>             Project: Hibernate3
>          Issue Type: Patch
>          Components: core
>            Reporter: Gavin King
>            Assignee: Steve Ebersole
>             Fix For: 3.3
>
>         Attachments: HHH-530.Additional.Subquery.patch, HHH-530.patch, hibernate_filter_fix-3.0.5.patch, hibernate_filter_fix-3.0.5_14.patch, SubqueriesWithFiltersTest.patch
>
>
> Currently filter conditions are applied in subselects, they should not be.

-- 
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