[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4764) org.hibernate.test.pagination.PaginationTest.testLimitOffset() fails on oracle and db2 due to

Strong Liu (JIRA) noreply at atlassian.com
Thu Jan 7 16:54:29 EST 2010


org.hibernate.test.pagination.PaginationTest.testLimitOffset() fails on oracle and db2 due to 
----------------------------------------------------------------------------------------------

                 Key: HHH-4764
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4764
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.0-Beta-2, 3.5.0.Beta-1, 3.3.2
         Environment: oracle, db2
            Reporter: Strong Liu
             Fix For: 3.3.x, 3.5


the code below, will call Dialect#getLimitString(String query, int offset, int limit), after a little debug, I found that the limit's value is -2147483550!
*-2147483550 = 99 + Integer.MAX_VALUE*

{code:title=org.hibernate.test.pagination.PaginationTest}
// line 127
result = generateBaseCriteria( session ).setFirstResult( 99 ).setMaxResults( Integer.MAX_VALUE ).list();
assertEquals( 1, result.size() );
{code} 

in Loader.java
{code:title=Loader}
	private static int getMaxOrLimit(final RowSelection selection, final Dialect dialect) {
		final int firstRow = dialect.convertToFirstRowValue( getFirstRow( selection ) );
		final int lastRow = selection.getMaxRows().intValue();
		if ( dialect.useMaxForLimit() ) {
			return ( lastRow + firstRow ) ;
		}
		else {
			return lastRow;
		}
	}
{code}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list