[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-700?page=all ]
Max Rydahl Andersen closed HBX-700:
-----------------------------------
Resolution: Duplicate
should be solved by the issue that want to provide a db-type/native-type in type-mapping
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
Type: Bug
Components: reverse-engineer
Environment: 3.2 svn, Oracle 10g, Oracle JDBC Driver version - "10.2.0.1.0"
Reporter: Genandiy Donchyts
Attachments: Test.hbm.xml, hbm2java.cfg.xml, schema.sql
Original Estimate: 1 hour
Remaining: 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:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira