When reverse-engineering Oracle database containint column with TIMESTAMP(3) type it is not recognized as a TIMESTAMP and "serializable" type is used instead of timestamp. This happens because of the bug in Oracle JDBC driver since it returns OTHER (1111) instead of TIMESTAMP(93).
When type-mapping is provided in the form:
<type-mapping>
<sql-type jdbc-type="TIMESTAMP(3)" hibernate-type="timestamp" />
</type-mapping>
... it is not used because hibernate can't find TIMESTAMP(3) JDBC data type.
JDBCReader.java, processBasicColumns(Table table, ProgressListener progress):
...
//TODO: column.setSqlType(sqlTypeName); //this does not work 'cos the precision/scale/length are not retured in TYPE_NAME
//column.setSqlType(sqlTypeName);
...
it would be nice to have this sqlTypeName set to Column and used during comparison with <type-mapping>, then mapping from "TIMESTAMP(3)" to "timestamp" would work. Currently only 1111 ("OTHER") is passed to Column and as result column does not know anything about "TIMESTAMP(3)"
To reproduce an issue try to create simple Oracle database with one table:
create table test(id TIMESTAMP(3));
and run reverse-engineering task over it.
------
HACK: custom handling of TIMESTAMP
types:
Modify JDBCReader.java:
private void processBasicColumns(Table table, ProgressListener progress) { // get the columns
...
String sqlTypeName = (String) columnRs.get("TYPE_NAME");
String columnName = (String) columnRs.get("COLUMN_NAME");
// HACK: custom handling of TIMESTAMP
if(sqlTypeName.startsWith("TIMESTAMP")) {
sqlType = java.sql.Types.TIMESTAMP;
}
...
See also forum post: http://forum.hibernate.org/viewtopic.php?t=961625&start=0&postdays=0&postorder=asc&highlight=
results of reverse-engineering