-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Custom reveng strategy being ignored
PostPosted: Sun Mar 26, 2006 9:36 pm 
Beginner
Beginner

Joined: Fri Jun 10, 2005 5:26 am
Posts: 25
Location: Adelaide, South Australia
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 26, 2006 9:42 pm 
Beginner
Beginner

Joined: Fri Jun 10, 2005 5:26 am
Posts: 25
Location: Adelaide, South Australia
Playing around a little more - adding:
Code:
      <sql-type jdbc-type="DECIMAL" hibernate-type="java.lang.Integer"/>

to the hibernate.reveng.xml file above now successfully maps to java.lang.Integer.

Does this suggest the only way to fix the problem is to refine the way all the fields are configured in Oracle?

This still doesn't explain why the Custom reverse engineering strategy implementation is being completely ignored.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 28, 2006 5:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if i understand you correctly then what this means is that the sql type returned my your driver for those fields are DECIMAL and not NUMERIC.

remember the jdbc-type is what is defined in java.sql.Types and this does not always correspond to the same names as the db specific name.

(at some point i might add support for db-type or something to allow using db specific names)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.