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].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to