Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359130

Summary: DBWSBuilder - JDBC metadata for 'DATE' wrong for Oracle
Product: z_Archived Reporter: Mike Norman <michael.norman>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipselink.dbws-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 359587    

Description Mike Norman CLA 2011-09-27 15:21:09 EDT
Starting from the table below:
  CREATE TABLE SECONDARY (
    EMPNO NUMERIC(4),
    ENAME VARCHAR(10),
    JOB VARCHAR(9),
    MGR NUMERIC(4),
    HIREDATE DATE,
    SAL DECIMAL(7,2),
    COMM DECIMAL(7,2),
    DEPTNO NUMERIC(2),
    PRIMARY KEY (EMPNO) 
  )
build a CustomSQL operation with 'build' SQL:

<?xml version="1.0" encoding="UTF-8"?>
<dbws-builder xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <properties>
    <property name="projectName">@PROJECT@</property>
    <property name="logLevel">@LOG_LEVEL@</property>
    <property name="username">@DB_USER@</property>
    <property name="password">@DB_PASSWORD@</property>
    <property name="url">@DB_URL@</property>
    <property name="driver">@DB_DRIVER@</property>
    <property name="platformClassname">@DB_PLATFORM@</property>
    <property name="dataSource">@DATASOURCE@</property>
    <property name="wsdlLocationURI">@WSDL_LOCATION@</property>
  </properties>
  <sql
    name="allSecondary"
    isCollection="true"
    >
    <statement>select * from SECONDARY</statement>
    <build-statement>select * from SECONDARY where 0=1</build-statement>
</dbws-builder>

When DBWSBuilder get the JDBC metadata for the ResultSet of running
'select * from SECONDARY where 0=1', the jdbc type code for HIREDATE
is 93 (TIMESTAMP), not 91
Comment 1 Mike Norman CLA 2011-09-27 15:41:58 EDT
This is a known problem with Oracle JDBC metadata. Previous to 11gR1, setting
the system properties: -Doracle.jdbc.V8Compatible=true and
-Doracle.jdbc.mapDateToTimeStamp=false solved the problem.

Unfortunately, these settings no longer work.

Temporary hack in BaseDBWSBuilderHelper>>buildORFieldMappingFromColumn
(and buildOXFieldMappingFromColumn)


        else {
            attributeClass = getClassFromJDBCType(dmdTypeName.toUpperCase(), databasePlatform);
        }
        //https://bugs.eclipse.org/bugs/show_bug.cgi?id=359130
        //problem with conversion and Oracle11 platform 
        if (attributeClass.getName().contains("oracle.sql.TIMESTAMP")) {
            attributeClass = java.sql.Timestamp.class;
        }
Comment 2 Mike Norman CLA 2011-12-09 09:46:28 EST
Closing since there isn't any other way to solve this other than the 'hack' refered to in code
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:15:18 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:30:20 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink