]
Max Rydahl Andersen reopened HBX-700:
-------------------------------------
can't find the duplicate issue so lets transform this one to what it is really about
Custom type mapping is not possible when reverse-engineering Oracle
TIMESTAMP(3) types
--------------------------------------------------------------------------------------
Key: HBX-700
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-700
Project: Hibernate Tools
Issue Type: Bug
Components: reverse-engineer
Environment: 3.2 svn, Oracle 10g, Oracle JDBC Driver version -
"10.2.0.1.0"
Reporter: Genandiy Donchyts
Attachments: hbm2java.cfg.xml, schema.sql, Test.hbm.xml
Original Estimate: 1 hour
Remaining Estimate: 1 hour
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&postday...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: