Community
Participate
Working Groups
See the bug in Oracle bug base: https://bug.oraclecorp.com/pls/bug/webbug_print.show?c_rptno=13254054
*** EDTANG 10/25/11 10:09 am *** @ SR # (MANDATORY FOR BUGS INVOLVING A CUSTOMER): ----------------------------------------------- PROBLEM DESCRIPTION (REQUIRED): ------------------------------- Some XDB tests failed with Oracle 11.2.0.3 JDBC driver. Error Message: java.sql.SQLException: Invalid column type: sqlType=2009 JDBC VERSION AND NAME OF JDBC JAR FILE (REQUIRED): -------------------------------------------------- Version: 11.2.0.3 JARs: ojdbc6.jar, xdb6.jar DOES ISSUE REPRODUCE WITH PREVIOUS JDBC VERSION? (REQUIRED FOR INTERNAL BUGS): ------------------------------------------------------------------------------ The tests passed with 11.2.0.2 JDBC driver(ojdbc6.jar and xdb.jar) DIAGNOSTIC ANALYSIS (REQUIRED): ------------------------------- These tests set NULL to the field of Document type. Looks like 11.2.0.3 JDBC driver doesn't support NULL to the field of Document type any more. STACK TRACE / RELEVANT THREAD DUMP INFORMATION: ----------------------------------------------- Internal Exception: java.sql.SQLException: Invalid column type: sqlType=2009 Error Code: 17004 Call: INSERT INTO EMPLOYEE_XML (ID, FIRST_NAME, GENDER, LAST_NAME, PAYROLL_XML, RESUME_XML, MANAGER_ID) VALUES (?, ?, ?, ?, ?, ?, ?) bind => [7 parameters bound] Query: InsertObjectQuery(org.eclipse.persistence.testing.tests.xdb.Employee_XML@40c55 77c) Caused by: java.sql.SQLException: Invalid column type: sqlType=2009 at oracle.jdbc.driver.OraclePreparedStatement.setNullCritical(OraclePreparedState ment.java:4659) at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.jav a:4541) at oracle.jdbc.driver.OraclePreparedStatementWrapper.setNull(OraclePreparedStatem entWrapper.java:1283) at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.setNullFromDa tabaseField(DatabasePlatform.java:2253) at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.setParameterV alueInDatabaseCall(DatabasePlatform.java:2210) at org.eclipse.persistence.platform.database.oracle.Oracle9Platform.setParameterV alueInDatabaseCall(Oracle9Platform.java:478) at org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareStatement( DatabaseCall.java:716) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteC all(DatabaseAccessor.java:585) WORKAROUND: ----------- TESTCASE DETAILS (REQUIRED): ---------------------------- These tests set NULL to the field of Document type. TESTCASE STEP-BY-STEP INSTRUCTIONS: ----------------------------------- GENERIC/PORT-SPECIFIC FINDINGS: ------------------------------- RELATED BUGS: ------------- IMPACT DATE: ------------ *** IASREP 10/25/11 10:30 am *** (CHG: Asg->PSLO) *** JDELAVAR 11/02/11 05:45 pm *** (CHG: Asg->SWARAO) *** SWARAO 11/10/11 04:50 am *** (CHG: Asg->EDTANG) *** SWARAO 11/10/11 04:50 am *** setNull(idx, Types.SQLXML) is failing and this is as expected. It is said to work with 11202, however, on seeing the org.eclipse.persistence code it looks like getJDBCType() method is used to determine the type and accordingly setNull is invoked. Earlier OPAQUE/XMLType was returned as Types.varchar and hence with 11202 it seems to have worked. With 11203 & ojdbc6.jar, the condition in getJDBCType() isn't being satisfied and hence the failure. So getJDBCType needs to be updated in org.eclipse.persistence. *** EDTANG 11/30/11 07:30 am *** (CHG: Asg->TOPLINK)
Created attachment 215099 [details] Suggested patch For some reason Oracle OraclePreparedStatement.setNull for a database field of type SYS.XMLType should be Types.VARCHAR (both OracleTypes.OPAQUE and OracleTypes.SQLXML cause the exception). Oracle jdbc 11.2.0.2 and before OracleResultSetMetaData returned column type OracleTypes.OPAQUE for SYS.XMLType db field - so we returned Types.VARCHAR instead of OracleTypes.OPAQUE; Oracle jdbc 11.2.0.3 OracleResultSetMetaData returns column type OracleTypes.SQLXML for SYS.XMLType db field - so the patch is to return Types.VARCHAR instead of OracleTypes.SQLXML, too.
Checked the fix into both trunk (2.4) and 2.3.3.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink