NHibernate 3.2 and Paging Oracle

三世轮回 提交于 2019-12-12 03:47:48

问题


I'm migrating web project asp.net VS2008 to VS2010, and NH 2.1 to NH 3.2.

Now, paging using NH 3.2 not work.

NHibernate 3.2 SetFirstresult, Setmaxresults paging problem oracle
https://groups.google.com/forum/#!topic/nhusers/1kp0hDfVol0

Code, the same for vs2008 and vs2010, but using NH 3.2, paging not works

  var response = new GetComunicacionesXFiltroResponse();

        //Sesion
        using (ISession session = NHibernateHelper.OpenSession(FlushMode.Never))
        {
            IQuery query = GetQueryForGetComunicacionesXFiltro(request, false, session);
            if (request.PagingInfo != null)
            {
                query.SetMaxResults(request.PagingInfo.RowCount);
                query.SetFirstResult((request.PagingInfo.PageNumber - 1) * request.PagingInfo.RowCount);
            }
            response.Comunicaciones = ComunicacionMapper.Map(query.List<Comunicacion>());

        }

Config for NH 3.2

<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
  <reflection-optimizer use="false"/>
  <session-factory>
    <property name="connection.connection_string_name">XXX.ConnectionStrings.Oracle.XXX</property>
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    <property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
    <property name="connection.isolation">ReadCommitted</property>
    <property name="dialect">NHibernate.Dialect.Oracle9iDialect</property>

    <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
    <property name="show_sql">false</property>
    <property name="use_proxy_validator">false</property>
    <!--DEPRECATED<property name="use_outer_join">true</property>-->
    <mapping assembly="XXX.MonitorizacionB2b.DomainModel"/>
  </session-factory>
</hibernate-configuration>

any suggestions about it ?


回答1:


Iran into the same problem. Paging is working in 3.3. Download the source and compile it yourself or pull the nightly builds from

http://teamcity.codebetter.com/viewType.html?buildTypeId=bt7&tab=buildTypeStatusDiv



来源:https://stackoverflow.com/questions/10139766/nhibernate-3-2-and-paging-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!