Details
Description
createSchema uses jdbc metadata to find out the type name correspondent to a certain type. Unfortunately this cannot be trusted for Oracle database, using the ojdbc5.jar shipped with Oracle 11G results in the following type map:
(typeCode: typeName)
-104: INTERVALDS
-103: INTERVALYM
-102: TIMESTAMP WITH LOCAL TIME ZONE
-101: TIMESTAMP WITH TIME ZONE
-7: NUMBER
-6: NUMBER
-5: NUMBER
-4: LONG RAW
-3: RAW
-1: LONG
1: CHAR
2: NUMBER
4: NUMBER
5: NUMBER
6: FLOAT
7: REAL
12: VARCHAR2
92: DATE
93: DATE
93: TIMESTAMP
2002: STRUCT
2003: ARRAY
2004: BLOB
2005: CLOB
2006: REF
As you can see 91, which is Types.DATE, is not mapped. This is evidently a bug in the driver, yet the dialect should provide a way to circumvent this.
As a result, OracleDataStoreTest.testCreateSchema fails with an exception stating "dateProperty" is not mapped.
I suggest we add a SqlDialect.getTypeName(int typeCode) that returns the type name, or null if we want the metadata to be used instead.
registerSqlTypeNameToClassMappings(Map<String, Class<?>> mappings)
registerSqlTypeToClassMappings(Map<Integer, Class<?>> mappings)
registerClassToSqlMappings(Map<Class<?>, Integer> mappings)
I believe the third one could be used in this case? Perhaps not, just not sure if you were aware of the method.