[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3694) ResultTransformer not used when scroll() is used on a named SQLQuery

Shawn Clowater (JIRA) noreply at atlassian.com
Wed Aug 5 15:48:14 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33709#action_33709 ] 

Shawn Clowater commented on HHH-3694:
-------------------------------------

The issue I'm currently running into is duplicates even though my criteria has a DistinctRootEntityResultTransformer set on it.

However, even with the supposed fix it would be useless since it would try to distinct based on a single result which would essentially just return the tuple anyways.

I would think to do it in the core I'd need some sort of Stateful transformer that could keep track of what it already scrolled over but that gets messy as when the ScrollableResultSet would attempt to get a record it could be a duplicate that you'd want to ignore so it would have to try again.

The path of least resistance for me is going to be to keep track of it during my processing (which I have a good point to tie into) but I thought I'd throw out the fact that scroll would return duplicates even if it was properly using a DistinctRootEntityResultTransformer for discussion.

> ResultTransformer not used when scroll() is used on a named SQLQuery
> --------------------------------------------------------------------
>
>                 Key: HHH-3694
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3694
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.3.1
>         Environment: Hibernate Core 3.3.1, PostgreSQL 8.1, HSQLDB 1.8
>            Reporter: Oscar Pearce
>            Priority: Minor
>         Attachments: sqlqueryrestrans.zip
>
>
> If a ResultTransformer is set on a named SQLQuery, and then scroll() is used on the query, the ResultTransformer is never used.  The unit test in the attached Maven project shows this.
> The fix seems simple - a one-line change in org.hibernate.loader.custom.CustomLoader#getHolderInstantiator(ResultTransformer resultTransformer, String[] queryReturnAliases).  The sense of the test of resultTransformer against null should be reversed.

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