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

Angel (JIRA) noreply at atlassian.com
Thu Feb 11 18:36:29 EST 2010


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

Angel commented on HHH-3694:
----------------------------

Hi.

I have been having a deeper look through the Hibernate code and finally I was able to make it work. The problem is that the only thing I had to do is to comment a few lines in the org.hibernate.loader.custom.CustomLoader.java and I do not understand why those lines where there in the first place, because if you analyze it, they do not make much sense. Also, this code do not have any comments, so I do not know why this control sentence was made for. Now my fear is if after this change I will get any unexpected behaviour, but my tests are still succesful.

I am attaching the patch that I have made to make this work. I am using Hibernate 3.2.6 GA

Specifically I have to change the method:  static private HolderInstantiator getHolderInstantiator(ResultTransformer resultTransformer, String[] queryReturnAliases);
and now it look like this:

	static private HolderInstantiator getHolderInstantiator(ResultTransformer resultTransformer, String[] queryReturnAliases) {
//		if ( resultTransformer != null ) {
//			return HolderInstantiator.NOOP_INSTANTIATOR;
//		}
//		else {
			return new HolderInstantiator(resultTransformer, queryReturnAliases);
//		}
	}

It would be appreciated if someone could notice any problem after applying this patch and leave feedback here.

Cheers.


> 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: CustomLoader.patch, 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