thanx  Ian Nelson,
any body give me an alternate way.

On Wed, Sep 29, 2010 at 1:53 PM, Ian Nelson <[email protected]> wrote:

> This is symptomatic of bug 1090 - Query cache does not work when using
> Criteria API to create a projection query with a result transformer
>
> See http://216.121.112.228/browse/NH-1090
>
> <http://216.121.112.228/browse/NH-1090>Regards
> Ian
>
> Ian Nelson
> http://ianfnelson.com
> http://iannelsonsystems.com
>
>
>
> On Wed, Sep 29, 2010 at 06:45, harshil <[email protected]> wrote:
>
>> Hi friends,
>>
>> After enabling Query Cache,  SetResultTransformer in Criteria  API
>> getting error
>>
>> Unable to cast object of type ' MYDTO'  to type 'System.Object[]'.
>>
>> >>>in the sample my  DTO name is 'MYDTO'
>>
>> Error:
>> NHibernate.Util.ADOExceptionReporter - Unable to cast object of type
>> 'MYDTO' to type 'System.Object[]'.
>>
>>
>>           ICriteria criteria = base.CreateCriteria();
>>            ProjectionList projectionList =
>> Projections.ProjectionList();
>>            projectionList.Add(Projections.Property("Id"), "ID");
>>            projectionList.Add(Projections.Property(ColumnAlias),
>> "ColumnValue");
>>            projectionList.Add(Projections.Property(AccountCode),
>> "AccountCode");
>>            criteria.SetProjection(projectionList);
>>
>>
>> criteria.SetResultTransformer(NHibernate.Transform.Transformers.AliasToBean(typeof(MYDTO)));
>>       IList<MYDTO> MYDTOList=criteria.List<MYDTO>();   <<< in this
>> point i get error
>>
>>
>> Please find the error complete details
>>
>>  WARN
>>
>>  NHibernate.Util.ADOExceptionReporter - System.InvalidCastException:
>> Unable to cast object of type 'MYDTO' to type 'System.Object[]'.
>>   at NHibernate.Cache.StandardQueryCache.Put(QueryKey key,
>> ICacheAssembler[] returnTypes, IList result, Boolean
>> isNaturalKeyLookup, ISessionImplementor session)
>>   at
>> NHibernate.Loader.Loader.PutResultInQueryCache(ISessionImplementor
>> session, QueryParameters queryParameters, IType[] resultTypes,
>> IQueryCache queryCache, QueryKey key, IList result)
>>   at NHibernate.Loader.Loader.ListUsingQueryCache(ISessionImplementor
>> session, QueryParameters queryParameters, ISet`1 querySpaces, IType[]
>> resultTypes)
>>   at NHibernate.Loader.Loader.List(ISessionImplementor session,
>> QueryParameters queryParameters, ISet`1 querySpaces, IType[]
>> resultTypes)
>>   at
>> NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor
>> session)
>>   at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList
>> results)
>>
>>
>>  ERROR
>>
>>  NHibernate.Util.ADOExceptionReporter - Unable to cast object of type
>> 'MYDTO' to type 'System.Object[]'
>>
>>
>>
>> --
>> 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]<nhusers%[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]<nhusers%[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