Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0, 2.0.0-M2
    • Component/s: None
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Running org.apache.openjpa.persistence.annotations.TestOneToOne
      0 TestConv INFO [main] openjpa.Runtime - Starting OpenJPA 2.0.0-SNAPSHOT
      47 TestConv INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.PostgresDictionary" (PostgreSQL 8.3.5 ,PostgreSQL Native Driver PostgreSQL 8.3 JDBC3 with SSL (build 603)).
      java.lang.ClassCastException: org.postgresql.util.PGobject
      at org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.AnnoTest2.pcReplaceField(AnnoTest2.java)
      at org.apache.openjpa.kernel.StateManagerImpl.replaceField(StateManagerImpl.java:3044)
      at org.apache.openjpa.kernel.DetachManager$DetachFieldManager.detachVersion(DetachManager.java:523)
      at org.apache.openjpa.kernel.DetachManager.detachInternal(DetachManager.java:455)
      at org.apache.openjpa.kernel.DetachManager.detachAll(DetachManager.java:317)
      at org.apache.openjpa.kernel.BrokerImpl.detachAllInternal(BrokerImpl.java:3293)
      at org.apache.openjpa.kernel.BrokerImpl.free(BrokerImpl.java:4185)
      at org.apache.openjpa.kernel.BrokerImpl.close(BrokerImpl.java:4172)
      at org.apache.openjpa.kernel.DelegatingBroker.close(DelegatingBroker.java:1316)
      at org.apache.openjpa.persistence.EntityManagerImpl.close(EntityManagerImpl.java:1154)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.closeAllOpenEMs(PersistenceTestCase.java:216)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.closeEMF(PersistenceTestCase.java:195)
      at org.apache.openjpa.persistence.common.utils.AbstractTestCase.tearDown(AbstractTestCase.java:125)
      at junit.framework.TestCase.runBare(TestCase.java:130)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.runBare(PersistenceTestCase.java:443)
      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:173)
      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)
      0 TestConv INFO [main] openjpa.Runtime - Starting OpenJPA 2.0.0-SNAPSHOT
      63 TestConv INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.PostgresDictionary" (PostgreSQL 8.3.5 ,PostgreSQL Native Driver PostgreSQL 8.3 JDBC3 with SSL (build 603)).
      0 TestConv INFO [main] openjpa.Runtime - Starting OpenJPA 2.0.0-SNAPSHOT
      47 TestConv INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.PostgresDictionary" (PostgreSQL 8.3.5 ,PostgreSQL Native Driver PostgreSQL 8.3 JDBC3 with SSL (build 603)).
      0 TestConv INFO [main] openjpa.Runtime - Starting OpenJPA 2.0.0-SNAPSHOT
      47 TestConv INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.PostgresDictionary" (PostgreSQL 8.3.5 ,PostgreSQL Native Driver PostgreSQL 8.3 JDBC3 with SSL (build 603)).
      java.lang.ClassCastException: org.postgresql.util.PGobject
      at org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.AnnoTest2.pcReplaceField(AnnoTest2.java)
      at org.apache.openjpa.kernel.StateManagerImpl.replaceField(StateManagerImpl.java:3044)
      at org.apache.openjpa.kernel.DetachManager$DetachFieldManager.detachVersion(DetachManager.java:523)
      at org.apache.openjpa.kernel.DetachManager.detachInternal(DetachManager.java:455)
      at org.apache.openjpa.kernel.DetachManager.detachAll(DetachManager.java:317)
      at org.apache.openjpa.kernel.BrokerImpl.detachAllInternal(BrokerImpl.java:3293)
      at org.apache.openjpa.kernel.BrokerImpl.free(BrokerImpl.java:4185)
      at org.apache.openjpa.kernel.BrokerImpl.close(BrokerImpl.java:4172)
      at org.apache.openjpa.kernel.DelegatingBroker.close(DelegatingBroker.java:1316)
      at org.apache.openjpa.persistence.EntityManagerImpl.close(EntityManagerImpl.java:1154)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.closeAllOpenEMs(PersistenceTestCase.java:216)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.closeEMF(PersistenceTestCase.java:195)
      at org.apache.openjpa.persistence.common.utils.AbstractTestCase.tearDown(AbstractTestCase.java:125)
      at junit.framework.TestCase.runBare(TestCase.java:130)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.runBare(PersistenceTestCase.java:443)
      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:173)
      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)
      0 TestConv INFO [main] openjpa.Runtime - Starting OpenJPA 2.0.0-SNAPSHOT
      46 TestConv INFO [main] openjpa.jdbc.JDBC - Using dictionary class "org.apache.openjpa.jdbc.sql.PostgresDictionary" (PostgreSQL 8.3.5 ,PostgreSQL Native Driver PostgreSQL 8.3 JDBC3 with SSL (build 603)).
      java.lang.ClassCastException: org.postgresql.util.PGobject
      at org.apache.openjpa.persistence.annotations.common.apps.annotApp.annotype.AnnoTest2.pcReplaceField(AnnoTest2.java)
      at org.apache.openjpa.kernel.StateManagerImpl.replaceField(StateManagerImpl.java:3044)
      at org.apache.openjpa.kernel.DetachManager$DetachFieldManager.detachVersion(DetachManager.java:523)
      at org.apache.openjpa.kernel.DetachManager.detachInternal(DetachManager.java:455)
      at org.apache.openjpa.kernel.DetachManager.detachAll(DetachManager.java:317)
      at org.apache.openjpa.kernel.BrokerImpl.detachAllInternal(BrokerImpl.java:3293)
      at org.apache.openjpa.kernel.BrokerImpl.free(BrokerImpl.java:4185)
      at org.apache.openjpa.kernel.BrokerImpl.close(BrokerImpl.java:4172)
      at org.apache.openjpa.kernel.DelegatingBroker.close(DelegatingBroker.java:1316)
      at org.apache.openjpa.persistence.EntityManagerImpl.close(EntityManagerImpl.java:1154)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.closeAllOpenEMs(PersistenceTestCase.java:216)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.closeEMF(PersistenceTestCase.java:195)
      at org.apache.openjpa.persistence.common.utils.AbstractTestCase.tearDown(AbstractTestCase.java:125)
      at junit.framework.TestCase.runBare(TestCase.java:130)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.runBare(PersistenceTestCase.java:443)
      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:173)
      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)

        Activity

        Hide
        Donald Woods added a comment -

        applied patch to 1.3.x

        Show
        Donald Woods added a comment - applied patch to 1.3.x
        Hide
        Ravi P Palacherla added a comment -

        This test case (with out any patches) is running fine against oracle DB on trunk at revision 773950.

        mvn clean test -Dtest=TestOneToOne -Ptest-custom -Dopenjpa.custom.driverjar=ojdbc14.jar -Dopenjpa.custom.driverclass=oracle.jdb
        c.driver.OracleDriver -Dopenjpa.custom.url=jdbc:oracle:thin:@xxxxx -Dopenjpa.custom.username=scott -Dopenjpa.custom.password=tiger -DfailIfNoTests=false

        [INFO] ------------------------------------------------------------------------
        [INFO] Reactor Summary:
        [INFO] ------------------------------------------------------------------------
        [INFO] OpenJPA ............................................... SUCCESS [2.953s]
        [INFO] OpenJPA Utilities ..................................... SUCCESS [48.594s]
        [INFO] OpenJPA Kernel ........................................ SUCCESS [33.781s]
        [INFO] OpenJPA JDBC .......................................... SUCCESS [24.094s]
        [INFO] OpenJPA JPA ........................................... SUCCESS [16.203s]
        [INFO] OpenJPA JPA JDBC ...................................... SUCCESS [6:05.625s]
        [INFO] OpenJPA XML Store ..................................... SUCCESS [1.672s]
        [INFO] OpenJPA Slice ......................................... SUCCESS [7.375s]
        [INFO] OpenJPA Aggregate Jar ................................. SUCCESS [0.750s]
        [INFO] OpenJPA with Dependencies Aggregate Jar ............... SUCCESS [2.421s]
        [INFO] OpenJPA Distribution .................................. SUCCESS [1.375s]
        [INFO] OpenJPA Persistence Examples .......................... SUCCESS [2.047s]
        [INFO] OpenJPA Integration Tests ............................. SUCCESS [0.532s]
        [INFO] OpenJPA Examples Integration Tests .................... SUCCESS [0.421s]
        [INFO] OpenJPA JPA TCK Integration Tests ..................... SUCCESS [0.688s]
        [INFO] ------------------------------------------------------------------------
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD SUCCESSFUL
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 8 minutes 30 seconds

        Show
        Ravi P Palacherla added a comment - This test case (with out any patches) is running fine against oracle DB on trunk at revision 773950. mvn clean test -Dtest=TestOneToOne -Ptest-custom -Dopenjpa.custom.driverjar=ojdbc14.jar -Dopenjpa.custom.driverclass=oracle.jdb c.driver.OracleDriver -Dopenjpa.custom.url=jdbc:oracle:thin:@xxxxx -Dopenjpa.custom.username=scott -Dopenjpa.custom.password=tiger -DfailIfNoTests=false [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] ------------------------------------------------------------------------ [INFO] OpenJPA ............................................... SUCCESS [2.953s] [INFO] OpenJPA Utilities ..................................... SUCCESS [48.594s] [INFO] OpenJPA Kernel ........................................ SUCCESS [33.781s] [INFO] OpenJPA JDBC .......................................... SUCCESS [24.094s] [INFO] OpenJPA JPA ........................................... SUCCESS [16.203s] [INFO] OpenJPA JPA JDBC ...................................... SUCCESS [6:05.625s] [INFO] OpenJPA XML Store ..................................... SUCCESS [1.672s] [INFO] OpenJPA Slice ......................................... SUCCESS [7.375s] [INFO] OpenJPA Aggregate Jar ................................. SUCCESS [0.750s] [INFO] OpenJPA with Dependencies Aggregate Jar ............... SUCCESS [2.421s] [INFO] OpenJPA Distribution .................................. SUCCESS [1.375s] [INFO] OpenJPA Persistence Examples .......................... SUCCESS [2.047s] [INFO] OpenJPA Integration Tests ............................. SUCCESS [0.532s] [INFO] OpenJPA Examples Integration Tests .................... SUCCESS [0.421s] [INFO] OpenJPA JPA TCK Integration Tests ..................... SUCCESS [0.688s] [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 8 minutes 30 seconds
        Hide
        Tim McConnell added a comment -

        Hi Albert, thanks much for reviewing....

        1) I created this patch against trunk

        2) I've run the build with security enabled tonight (for Derby and PostgreSQL) and did not encounter any security exceptions. I believe this is due to the following entry in the j2.security.test.policy file for the "file:///$

        {test.basedir}

        /-" CodeBase:

        permission java.lang.reflect.ReflectPermission "suppressAccessChecks";

        If you require any changes to the patch please let me. Thanks again.

        Show
        Tim McConnell added a comment - Hi Albert, thanks much for reviewing.... 1) I created this patch against trunk 2) I've run the build with security enabled tonight (for Derby and PostgreSQL) and did not encounter any security exceptions. I believe this is due to the following entry in the j2.security.test.policy file for the "file:///$ {test.basedir} /-" CodeBase: permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; If you require any changes to the patch please let me. Thanks again.
        Hide
        Albert Lee added a comment -

        I have one question and one request.

        1) What release is the patch was create? I can not find the corresponding revision. I jam ust curious and want to make sure I apply the patch to the right place.

        — openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java (revision 748781)

        2) Since you are using reflection, this may have impact to Java security. Can you re-run the patch against PostgreSQL with Java security enable and make sure you have not problem with the patch.

        mvn test -Penable-security .... plus the profile to run against PostgreSQL

        If you run into SecurityException, you may have to wrap around the "violator" with the appropriate doPriv construct. Look at J2DoPrivHelper/J2DoPriv5Helper and the code that uses them.

        Thanks,
        Albert Lee.

        Show
        Albert Lee added a comment - I have one question and one request. 1) What release is the patch was create? I can not find the corresponding revision. I jam ust curious and want to make sure I apply the patch to the right place. — openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java (revision 748781) 2) Since you are using reflection, this may have impact to Java security. Can you re-run the patch against PostgreSQL with Java security enable and make sure you have not problem with the patch. mvn test -Penable-security .... plus the profile to run against PostgreSQL If you run into SecurityException, you may have to wrap around the "violator" with the appropriate doPriv construct. Look at J2DoPrivHelper/J2DoPriv5Helper and the code that uses them. Thanks, Albert Lee.
        Hide
        Tim McConnell added a comment -

        Hi Milosz, thanks for reviewing. I've corrected the comments in this second patch.....

        Show
        Tim McConnell added a comment - Hi Milosz, thanks for reviewing. I've corrected the comments in this second patch.....
        Hide
        Milosz Tylenda added a comment -

        Tim, looks like an oversight is there - the comments in the patch refer to Oracle...

        Show
        Milosz Tylenda added a comment - Tim, looks like an oversight is there - the comments in the patch refer to Oracle...
        Hide
        Tim McConnell added a comment - - edited

        The latest PostgreSQL JDBC driver returns a returns a org.postgresql.util.PGobject object instead of a java.sql.Timestamp. This can be addressed by overriding the getObject() method in the PostgresDictionary to return a java.sql.Timestamp object when a PBobject is encountered. This patch will also fix many of the other failing PostgreSQL testcases failing with ClassCastException(s).

        Show
        Tim McConnell added a comment - - edited The latest PostgreSQL JDBC driver returns a returns a org.postgresql.util.PGobject object instead of a java.sql.Timestamp. This can be addressed by overriding the getObject() method in the PostgresDictionary to return a java.sql.Timestamp object when a PBobject is encountered. This patch will also fix many of the other failing PostgreSQL testcases failing with ClassCastException(s).

          People

          • Assignee:
            Tim McConnell
            Reporter:
            Tim McConnell
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development