NHibernate 3.2和Paging Oracle

时间:2012-04-13 11:13:28

标签: oracle nhibernate pagination version

我正在将web项目asp.net VS2008迁移到VS2010,将NH 2.1迁移到NH 3.2。

现在,使用NH 3.2进行分页不起作用。

NHibernate 3.2 SetFirstresult,Setmaxresults分页问题oracle
https://groups.google.com/forum/#!topic/nhusers/1kp0hDfVol0

代码,vs2008和vs2010相同,但使用NH 3.2,分页不起作用

  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>());

        }

配置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>

有关它的任何建议吗?

1 个答案:

答案 0 :(得分:0)

伊朗陷入同样的​​问题。分页工作在3.3。下载源代码并自行编译或从

中提取每晚构建版本

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