[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-530) Better handling of filter params in HQL to allow filter use on subqueries

Shawn Clowater (JIRA) noreply at atlassian.com
Mon Oct 1 17:42:25 EDT 2007


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

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

Well, I took a look at this original patch and of course the state of the world changed quite a bit since 3.0.5.  However, I think I have something that will work that is much less complex than the original patch.  The issue seems to be that once the process filters are done that you can't determine the order of the filters to positional values.

But, it looks like all the information is available as the filters are being processed to add both the filters and positional params in the correct order.  Essentially the patch is processing the filters in the same manner as it was before but for the positional piece it will add the parameters based on the ordinal value from the positionalValues/Types array as it encounters them.

The only changes to QueryParameters are really
				else {
                    if (token.equals( "?" ) && positionalIndex < getPositionalParameterValues().length) {
                        parameters.add( getPositionalParameterValues()[positionalIndex] );
                        parameterTypes.add( getPositionalParameterTypes()[positionalIndex] );
                        positionalIndex++;
                    }
                    result.append( token );
				}

removal of the
parameters.addAll( Arrays.asList( getPositionalParameterValues() ) );
parameterTypes.addAll( Arrays.asList( getPositionalParameterTypes() ) );

and the defining of the positionalIndex int variable.  For some reason my IDE wanted to reformat the white space.

The first concern I had was what happened if someone mixed and matched positional and named parameters but it would seem the parser disallows that.  I don't see any drawback to shuffling the parameters into the right order if all that is being done on the other side is mowing through them in order.

Note that this also assumes that the enabled filters are being passed through to the subquery.  That is disabled in the latest version of the code.

> Better handling of filter params in HQL to allow filter use on subqueries
> -------------------------------------------------------------------------
>
>                 Key: HHH-530
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-530
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>            Reporter: Gavin King
>            Assignee: Steve Ebersole
>         Attachments: hibernate_filter_fix-3.0.5.patch, hibernate_filter_fix-3.0.5_14.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