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.  [ 6 posts ] 
Author Message
 Post subject: Cannot control Hibernate reverse engineering strategy for NU
PostPosted: Tue Dec 18, 2007 7:36 pm 
Newbie

Joined: Tue Dec 18, 2007 7:33 pm
Posts: 1
I cannot change the default Hibernate behaviour to reverse engineering a NUMERIC(1) into a boolean java data type.

I tried to modify the reverse engineering file forcing all possible mapping without success.

How to reverse engineering an Oracle 9 NUMERIC(1) into a java.lang.Integer ???


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 5:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
reading the docs would be good start.

http://www.hibernate.org/hib_docs/tools ... ml#d0e1481

Notice the NUMERIC mapping in that example...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 6:00 am 
Newbie

Joined: Wed Sep 05, 2007 6:19 am
Posts: 11
same problem here.

those are the mapping tested:

Code:

<type-mapping>

<sql-type jdbc-type="NUMERIC" precision="1" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="NUMERIC" precision="2" scale="0" not-null="false" hibernate-type="Integer"/>
<sql-type jdbc-type="NUMERIC" precision="1" not-null="false"  hibernate-type="int"/>
<sql-type jdbc-type="NUMERIC" precision="2" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="NUMERIC" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="NUMERIC" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="NUMERIC" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="NUMERIC" scale="0" not-null="false" hibernate-type="Integer"/>


<sql-type jdbc-type="BIT" precision="1" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="BIT" precision="2" scale="0" not-null="false" hibernate-type="Integer"/>
<sql-type jdbc-type="BIT" precision="1" not-null="false"  hibernate-type="int"/>
<sql-type jdbc-type="BIT" precision="2" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="BIT" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="BIT" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="BIT" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="BIT" scale="0" not-null="false" hibernate-type="Integer"/>


<sql-type jdbc-type="BOOLEAN" precision="1" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="BOOLEAN" precision="2" scale="0" not-null="false" hibernate-type="Integer"/>
<sql-type jdbc-type="BOOLEAN" precision="1" not-null="false"  hibernate-type="int"/>
<sql-type jdbc-type="BOOLEAN" precision="2" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="BOOLEAN" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="BOOLEAN" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="BOOLEAN" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="BOOLEAN" scale="0" not-null="false" hibernate-type="Integer"/>


<sql-type jdbc-type="INTEGER" precision="1" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="INTEGER" precision="2" scale="0" not-null="false" hibernate-type="Integer"/>
<sql-type jdbc-type="INTEGER" precision="1" not-null="false"  hibernate-type="int"/>
<sql-type jdbc-type="INTEGER" precision="2" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="INTEGER" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="INTEGER" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="INTEGER" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="INTEGER" scale="0" not-null="false" hibernate-type="Integer"/>


<sql-type jdbc-type="SMALLINT" precision="1" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="SMALLINT" precision="2" scale="0" not-null="false" hibernate-type="Integer"/>
<sql-type jdbc-type="SMALLINT" precision="1" not-null="false"  hibernate-type="int"/>
<sql-type jdbc-type="SMALLINT" precision="2" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="SMALLINT" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="SMALLINT" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="SMALLINT" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="SMALLINT" scale="0" not-null="false" hibernate-type="Integer"/>


<sql-type jdbc-type="TINYINT" precision="1" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="TINYINT" precision="2" scale="0" not-null="false" hibernate-type="Integer"/>
<sql-type jdbc-type="TINYINT" precision="1" not-null="false"  hibernate-type="int"/>
<sql-type jdbc-type="TINYINT" precision="2" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="TINYINT" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="TINYINT" not-null="false"  hibernate-type="Integer"/>
<sql-type jdbc-type="TINYINT" scale="0" not-null="true"  hibernate-type="int"/>
<sql-type jdbc-type="TINYINT" scale="0" not-null="false" hibernate-type="Integer"/>



this is the DDL of the column:

Code:
"FMT_NUM_SEP_MGL" NUMBER(1)


the dialect is Oracle9 (tested also Oracle9g, and a dump/restore on a Oracle10i database, using the Oracle10i dialect)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 6:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
enable debug and look in the logs for your column and check what *jdbc type* oracle's driver is returning for number.

It is probably OTHER or something weird.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 6:27 am 
Newbie

Joined: Wed Sep 05, 2007 6:19 am
Posts: 11
now works.

i've hadded this to hibernate.properties

Code:
hibernatetool.metadatadialect org.hibernate.cfg.reveng.dialect.OracleMetaDataDialect


searching for the debug mode, I've found this parameter in jira


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 9:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
weird, latest tools should definitly use that by default if the dialect is OracleDialect...

_________________
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.  [ 6 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.