Skip to content

InvalidOperationException: This transformer is not initialized by Cached Query #3169

@chrisredburnetail

Description

@chrisredburnetail

Between version 5.3.10 and 5.3.11 the behaviour of cached SQL Query results changed when using AliasToBean transform.

ISession session;
session.CreateSQLQuery("select 'REGIONCODE' as regionCode  ")
		.AddScalar("regionCode", NHibernateUtil.String)
		.SetResultTransformer(Transformers.AliasToBean<ResultDto>())
		.SetCacheable(true)
		.List();

This works the first time through when caching is enabled, but when run again it fails with a "System.InvalidOperationException : This transformer is not initialized" exception.

I've created the attached Test Case which gives the exception in the second call to .List in the GetCacheableSqlQueryResults method.

In my actual code the SELECT statement involves tables and join, etc - its been simplified for this test case to not include any entities.

GH3169.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions