NotSupportedException on IQuery's Enumerable when using statelesssession
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.
精彩评论