开发者

NotSupportedException on IQuery's Enumerable when using statelesssession

开发者 https://www.devze.com 2022-12-24 22:30 出处:网络
when trying to use the Enumerable method on a named query, with a Stateless session, as shown in the example at:

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 i开发者_JAVA技巧n 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?


The doc is wrong. Also, by looking at it you can tell it's copied from Hibernate (Java).

Use the List method instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消