More info https://nhibernate.jira.com/browse/NH-1090

On Mon, Jul 25, 2011 at 9:03 AM, Craig van Nieuwkerk <[email protected]>wrote:

> I think this is fixed in NH 3.2 (to be released shortly).
>
> [NH-1090] - Query cache does not work when using Criteria API to create a
> projection query with a result transformer
>
> Craig
>
> On Mon, Jul 25, 2011 at 3:59 AM, fel0niousmonk <[email protected]>wrote:
>
>> I'm getting the following error:
>>
>> System.InvalidCastException occurred
>>  Message=Unable to cast object of type
>> 'AEGISweb.Data.Entities.TechSupportCallback' to type
>> 'System.Object[]'.
>>  Source=NHibernate
>>  StackTrace:
>>       at NHibernate.Cache.StandardQueryCache.Put(QueryKey key,
>> ICacheAssembler[] returnTypes, IList result, Boolean
>> isNaturalKeyLookup, ISessionImplementor session)
>>  InnerException:
>>
>> with a query + projection like:
>>
>> // open session & transaction in using (..)
>> // only return the properties we want!
>> var query = session.CreateCriteria<TechSupportCallback>()
>>  .SetCacheable(true)
>>  .SetCacheRegion("CallbacksByUserAndGroups")
>>  .SetProjection(Projections.ProjectionList()
>>      .Add(Projections.Alias(Projections.Id(), ex.NameOf(x =>
>> x.ID))) //
>>      .Add(Projections.Alias(Projections.Property(ex.NameOf(x =>
>> x.ContactID)), ex.NameOf(x => x.ContactID)))
>>      // ...
>>   )
>>   .SetResultTra...;
>>   rValue = query.List<TechSupportCallback>();
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to