NotSupportedException on IQuery's Enumerable when using statelesssession

Posted by user57555 on Stack Overflow See other posts from Stack Overflow or by user57555
Published on 2010-03-23T20:41:13Z Indexed on 2010/03/23 20:43 UTC
Read the original article Hit count: 372

when trying to use the Enumerable method on a named query, with a Stateless session, as shown in the example at:

http://www.nhforge.org/doc/nh/en/#batch-statelesssession

i am seeing a NotSupportedException. the stack trace is as below:

System.NotSupportedException: Specified method is not supported.
at NHibernate.Impl.StatelessSessionImpl.Enumerable(String query, QueryParameters parameters)
at NHibernate.Impl.QueryImpl.Enumerable()

here is a snippet of my code:

IStatelessSession statelessSession = sessionFactory.OpenStatelessSession();
var fileLines = statelessSession.GetNamedQuery("GetLinesByFileId")
.SetInt32("FileIdInput", fileId).Enumerable<FileLineEntity>();

the named query, GetLinesByFileId is defined in the hbm as below:

<query name="GetLinesByFileId" cacheable="false" read-only="true">
    <![CDATA[
        from FileLineEntity lineItem where lineItem.FileId=:FileIdInput 
      ]]>
  </query>

any suggestions on what i maybe missing here?

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about named-query