I think I have encountered a bug. I'm using v 2.1.2.4000 with the
following mapping:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <sql-query name="GetUserSecurity">
    exec getUserSecurity :UserId
  </sql-query>
</hibernate-mapping>

This stored procedure returns two columns.

When I call the following code with setCacheable(true) everything
works fine but as soon as I set it to true I get the
IndexOutOfRangeException (see full exception details below).

using (var session = sessionProvider.Create())
                using (var tx = session.BeginTransaction())
                {
                    security= session.GetNamedQuery("GetUserSecurity")
                        .SetParameter("UserId", 1234)
                        //.SetCacheable(true)
                        .List();

                    tx.Commit();
                }

Exception details:
System.IndexOutOfRangeException was unhandled by user code
  Message="Index was outside the bounds of the array."
  Source="NHibernate"
  StackTrace:
       at NHibernate.Type.TypeFactory.Disassemble(Object[] row,
ICacheAssembler[] types, Boolean[] nonCacheable, ISessionImplementor
session, Object owner)
       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.Custom.CustomLoader.List
(ISessionImplementor session, QueryParameters queryParameters)
       at NHibernate.Impl.SessionImpl.ListCustomQuery(ICustomQuery
customQuery, QueryParameters queryParameters, IList results)
       at NHibernate.Impl.SessionImpl.List(NativeSQLQuerySpecification
spec, QueryParameters queryParameters, IList results)
       at NHibernate.Impl.SessionImpl.List[T]
(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
       at NHibernate.Impl.SqlQueryImpl.List[T]()
       at Application_OnAuthenticateRequest(Object sender, EventArgs
e)
       at
System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)
  InnerException:

Thanks in advance
-- 
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