OpenJPA
  1. OpenJPA
  2. OPENJPA-1002

Select range doesn't work on Oracle JDBC driver

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0, 1.2.1, 1.3.0, 2.0.0-M2
    • Fix Version/s: 1.1.1, 2.0.0-M3
    • Component/s: jdbc
    • Labels:
      None
    • Environment:
      OS: windows XP professional
      java version 1.5.0_14
      Oracle jdbc driver 10.2.0.1.0
    • Patch Info:
      Patch Available

      Description

      Select range doesn't work on Oracle with Oracle jdbc driver 10.2.0.1.0.
      The test case is like below:
      OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
      FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
      fetch.addField(EagerOuterJoinPC.class, "stringList");
      fetch.setFetchBatchSize(3);
      OpenJPAQuery q = pm.createQuery(JPQLParser.LANG_JPQL,
      "select x from EagerOuterJoinPC x order by x.name asc");
      q.setFirstResult(5).setMaxResults(15);

      List results = (List) q.getResultList();
      assertEquals(5, results.size());

      The assertion passed on Derby. But failed on Oracle:
      junit.framework.AssertionFailedError: expected:<5> but was:<10>
      at junit.framework.Assert.fail(Assert.java:47)
      at junit.framework.Assert.failNotEquals(Assert.java:282)
      at junit.framework.Assert.assertEquals(Assert.java:64)
      at junit.framework.Assert.assertEquals(Assert.java:201)
      at junit.framework.Assert.assertEquals(Assert.java:207)
      at org.apache.openjpa.persistence.jdbc.meta.TestEagerOuterToManyJoins.testQueryRange(TestEagerOuterToManyJoins.java:679)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.run(PersistenceTestCase.java:127)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
      at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334)
      at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980)

      1. 1002.patch
        8 kB
        Amy Yang
      2. 1002_Headtrunk.patch
        4 kB
        Ravi P Palacherla
      3. TestEagerOuterToManyJoins1.java
        4 kB
        Ravi P Palacherla

        Activity

        Hide
        Donald Woods added a comment -

        Please consider for 1.0.x and 1.2.x.

        Show
        Donald Woods added a comment - Please consider for 1.0.x and 1.2.x.
        Hide
        David Ezzio added a comment -

        Merged change at trunk revision 769505 to branch 1.1.x at revision 793096

        Show
        David Ezzio added a comment - Merged change at trunk revision 769505 to branch 1.1.x at revision 793096
        Hide
        Donald Woods added a comment -

        Still needs to be applied to 1.3.x.

        Show
        Donald Woods added a comment - Still needs to be applied to 1.3.x.
        Hide
        David Ezzio added a comment - - edited

        Patch applied to trunk (currently 2.0.0 Snapshot). Revision 769505.

        Show
        David Ezzio added a comment - - edited Patch applied to trunk (currently 2.0.0 Snapshot). Revision 769505.
        Hide
        Donald Woods added a comment -

        adding [PATCH] and assigning to a release

        Show
        Donald Woods added a comment - adding [PATCH] and assigning to a release
        Hide
        Ravi P Palacherla added a comment -

        Can someone please commit my changes on the head revision.

        Thanks,
        Ravi.

        Show
        Ravi P Palacherla added a comment - Can someone please commit my changes on the head revision. Thanks, Ravi.
        Hide
        David Ezzio added a comment -

        Revision 765801 is misidentified in the commit message as applying to this bug. In fact, it actually applies to OpenJPA-1006.

        Show
        David Ezzio added a comment - Revision 765801 is misidentified in the commit message as applying to this bug. In fact, it actually applies to OpenJPA-1006.
        Hide
        Ravi P Palacherla added a comment -

        1002_Headtrunk.patch is ported patch on top of openjpa trunk.

        Adding a new testcase TestEagerOuterToManyJoins1.

        Steps that confirmed the fix is working:

        a. mvn clean test -Dtest=TestEagerOuterToManyJoins1 -DfailIfNoTests=false will result in success.
        b. mvn test -Dtest=TestEagerOuterToManyJoins1 -Ptest-custom -Dopenjpa.custom.driverjar=C:\bea\WLS100\wlserver_10.0\server\lib\ojdbc14.jar -Dopenjpa.custom.driverclass=oracle.jdbc.driver.OracleDriver -Dopenjpa.custom.url=jdbc:oracle:thin:@host:port:dbname -Dopenjpa.custom.username=user -Dopenjpa.custom.password=psswd -DfailIfNoTests=false

        will result in assertion issues.

        c. apply the attached patch.
        d. Run step B again and this time it will be a success.

        Show
        Ravi P Palacherla added a comment - 1002_Headtrunk.patch is ported patch on top of openjpa trunk. Adding a new testcase TestEagerOuterToManyJoins1. Steps that confirmed the fix is working: a. mvn clean test -Dtest=TestEagerOuterToManyJoins1 -DfailIfNoTests=false will result in success. b. mvn test -Dtest=TestEagerOuterToManyJoins1 -Ptest-custom -Dopenjpa.custom.driverjar=C:\bea\WLS100\wlserver_10.0\server\lib\ojdbc14.jar -Dopenjpa.custom.driverclass=oracle.jdbc.driver.OracleDriver -Dopenjpa.custom.url=jdbc:oracle:thin:@host:port:dbname -Dopenjpa.custom.username=user -Dopenjpa.custom.password=psswd -DfailIfNoTests=false will result in assertion issues. c. apply the attached patch. d. Run step B again and this time it will be a success.
        Hide
        Amy Yang added a comment -

        The attached patch includes fix and test case.

        To reproduce the error, applying the patch (excluding DBDictionary and OracleDictionary), run TestEagerOuterToManyJoins with Oracle jdbc driver, like:
        mvn test -Dtest= TestEagerOuterToManyJoins -Ptest-custom \
        -Dopenjpa.custom.driverjar=$(pwd)/drivers/jdbc-oracle-10_2_0_1_0.jar \
        -Dopenjpa.custom.driverclass=oracle.jdbc.driver.OracleDriver \
        -Dopenjpa.custom.url=jdbc:oracle:thin:@HOST:PORT:DBNAME \
        -Dopenjpa.custom.username=USERNAME \
        -Dopenjpa.custom.password=PASSWORD

        Show
        Amy Yang added a comment - The attached patch includes fix and test case. To reproduce the error, applying the patch (excluding DBDictionary and OracleDictionary), run TestEagerOuterToManyJoins with Oracle jdbc driver, like: mvn test -Dtest= TestEagerOuterToManyJoins -Ptest-custom \ -Dopenjpa.custom.driverjar=$(pwd)/drivers/jdbc-oracle-10_2_0_1_0.jar \ -Dopenjpa.custom.driverclass=oracle.jdbc.driver.OracleDriver \ -Dopenjpa.custom.url=jdbc:oracle:thin:@HOST:PORT:DBNAME \ -Dopenjpa.custom.username=USERNAME \ -Dopenjpa.custom.password=PASSWORD

          People

          • Assignee:
            Michael Dick
            Reporter:
            Amy Yang
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development