Community
Participate
Working Groups
Reproduced with ojdbc6.jar 11.2.0.2; xdb.jar, orai18n-mapping.jar, xml.jar, xmlparserv2.jar - all 11.2.0.0: Errors: TEST SUITE NAME: org.eclipse.persistence.testing.tests.jpa.customfeatures.CustomFeaturesJUnitTe stSuite TEST NAME: testBatchUpdates(org.eclipse.persistence.testing.tests.jpa.customfeatures.Cust omFeaturesJUnitTestSuite) ##FAILURE## RESULT: FatalError (error) @ java.lang.ClassCastException: oracle.jdbc.driver.OracleSQLXML cannot be cast to java.lang.String at org.eclipse.persistence.testing.models.jpa.customfeatures.Employee._persistenc e_set(Employee.java) at org.eclipse.persistence.internal.descriptors.PersistenceObjectAttributeAccesso r.setAttributeValueInObject(PersistenceObjectAttributeAccessor.java:46) at org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject(Dat abaseMapping.java:1393) at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(Databas eMapping.java:1284) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesInto Object(ObjectBuilder.java:342) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectB uilder.java:711) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyClo neNormally(ObjectBuilder.java:609) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOf Work(ObjectBuilder.java:562) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectB uilder.java:495) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectB uilder.java:454) at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelRe adQuery.java:721) at org.eclipse.persistence.queries.ReadAllQuery.registerResultInUnitOfWork(ReadAl lQuery.java:726) at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadA llQuery.java:423) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(Obje ctLevelReadQuery.java:1074) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:764) at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQu ery.java:1034) at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:383) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(Objec tLevelReadQuery.java:1112) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery( UnitOfWorkImpl.java:2910) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstrac tSession.java:1301) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstrac tSession.java:1283) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstrac tSession.java:1257) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImp l.java:479) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.j ava:714) at org.eclipse.persistence.testing.tests.jpa.customfeatures.CustomFeaturesJUnitTe stSuite.testBatchUpdates(CustomFeaturesJUnitTestSuite.java:137) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.j ava:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTes tCase.java:466) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at org.eclipse.persistence.testing.framework.TestExecutor.execute(TestExecutor.ja va:248) at org.eclipse.persistence.testing.framework.TestExecutor.runTest(TestExecutor.ja va:671) at org.eclipse.persistence.testing.framework.ui.SynchronizedTestExecutor.run(Sync hronizedTestExecutor.java:61) TEST SUITE NAME: org.eclipse.persistence.testing.tests.jpa.customfeatures.CustomFeaturesJUnitTe stSuite TEST NAME: testNamedStoredProcedureCursorQuery(org.eclipse.persistence.testing.tests.jpa. customfeatures.CustomFeaturesJUnitTestSuite) ##FAILURE## RESULT: FatalError (error) @ java.lang.ClassCastException: oracle.jdbc.driver.OracleSQLXML cannot be cast to java.lang.String at org.eclipse.persistence.testing.models.jpa.customfeatures.Employee._persistenc e_set(Employee.java) at org.eclipse.persistence.internal.descriptors.PersistenceObjectAttributeAccesso r.setAttributeValueInObject(PersistenceObjectAttributeAccessor.java:46) at org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject(Dat abaseMapping.java:1393) at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(Databas eMapping.java:1284) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesInto Object(ObjectBuilder.java:342) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectB uilder.java:711) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyClo neNormally(ObjectBuilder.java:609) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOf Work(ObjectBuilder.java:562) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectB uilder.java:495) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectB uilder.java:454) at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelRe adQuery.java:721) at org.eclipse.persistence.queries.ReadAllQuery.registerResultInUnitOfWork(ReadAl lQuery.java:726) at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadA llQuery.java:423) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(Obje ctLevelReadQuery.java:1074) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:764) at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQu ery.java:1034) at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:383) at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(Objec tLevelReadQuery.java:1112) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery( UnitOfWorkImpl.java:2910) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstrac tSession.java:1301) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstrac tSession.java:1283) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(Abstrac tSession.java:1257) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImp l.java:479) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl .java:745) at org.eclipse.persistence.testing.tests.jpa.customfeatures.CustomFeaturesJUnitTe stSuite.testNamedStoredProcedureCursorQuery(CustomFeaturesJUnitTestSuite.java: 208) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.j ava:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTes tCase.java:466) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at org.eclipse.persistence.testing.framework.TestExecutor.execute(TestExecutor.ja va:248) at org.eclipse.persistence.testing.framework.TestExecutor.runTest(TestExecutor.ja va:671) at org.eclipse.persistence.testing.framework.ui.SynchronizedTestExecutor.run(Sync hronizedTestExecutor.java:61)
Created attachment 176922 [details] Suggested patch The failure was caused by Oracle jdbc 11.2.0.2 driver reading database fields of type XMLDATA and XMLDOM into oracle.jdbc.driver.OracleSQLXML. This class implements java.sql.SQLXML interface introduced in jdk 1.6. Note that Oracle jdbc MetaData.getColumnType still returns a wrong sql type OracleType.OPAQUE (2007) instead of correct Types.SQLXML == OracleTypes.SQLXML == 2009 Also added SQLXML case to DatabasePlatform. The String should be extracted from SQLXML object while its transaction is still active, therefore (just like with lobs) can't place this code into conversion manager - it may be too late. To allow Eclipselink code to still be executable under jdk 1.5 added JDK16Platform class that encapsulates usage of the new classes defined in jdk 1.6.
Created attachment 176925 [details] corrected patch The original patch missed DatabasePlatform class.
Checked the patch into trunk (2.2), 2.1.2 is pending. Reviewed by Tom.
The patch checked into 2.1.2.
The fix was tested in TestingBrowser on Oracle db 11.2.0.1.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink