After some wonderful help from Max in getting debugging working with Ant and the hibernate tools tasks I'm now observing behaviour that sees any type of custom reverse engineering strategy I attempt being ignored.
I'm using an Oracle 10g database, and the fields I'm trying to alter are ones that are bizarrely mapped by default to BigDecimals and other weird scenarios.
First I tried the <type-mapping> option in hibernate.reveng.xml - according to the documentation, something like
Code:
<type-mapping>
<sql-type jdbc-type="NUMERIC" hibernate-type="java.long.Integer" />
</type-mapping>
should result in any mapped numeric field being forced to an integer object. However, it seems to be completely ignored and even any specialisation of the above, adding scale or precision information is equally ignored. I've checked the log4j output on DEBUG and the only messages relating to the fields in question look like:
Code:
[hibernatetool] 2006-03-27 11:02:33,611 [main] DEBUG org.hibernate.cfg.JDBCBinder - Sql type mismatch for Table: TDS03.SCH_TDS_SERVICES column: PERIOD between DB and wanted hibernate type. Sql type set to 3(DECIMAL) instead of 2(NUMERIC)
In oracle, the column in question is configured as a "NUMBER" with no precision or scale.
Secondly I've attempted to implement a custom reverse engineering strategy by implementing DelegatingReverseEngineeringStrategy. My custom strategy is defintely being called (I can see log4j output from it) and is overriding columns by returning "java.lang.Integer", for example, but the resulting mapping files don't reflect the override.