-->
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.  [ 5 posts ] 
Author Message
 Post subject: Type mapping during Reverse Engineering ignored
PostPosted: Fri Nov 14, 2008 7:14 am 
Newbie

Joined: Thu Nov 13, 2008 8:21 am
Posts: 8
I try to reverse engineer JPA entity classes from a Oracle 10g schema with the following hibernate.revenge.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
  <schema-selection match-schema="CRDE_ERFASSUNG" match-table="LS_LDP_.*" />
  <type-mapping>
    <sql-type jdbc-type="NUMERIC" precision="32" not-null="false" hibernate-type="java.lang.Long" />
    <sql-type jdbc-type="NUMERIC" precision="1" hibernate-type="java.lang.Byte" />
  </type-mapping>
</hibernate-reverse-engineering>


The appropriate DB columns are looking like this for instance

Code:
SATZ_ID|NUMBER(32,0)|NOT NULL|PK 

Code:
RELATION_ART_ANF_CODE|NUMBER(1,0)|NULL


I know that in case of satz_id the precision will be gone but this is different chapter :-)

The classes are generated properly but without the declared type mapping.

Am I doing something wrong?

I'm a using Eclipse 3.3.2, Hibernate-Core 3.2.2.Beta1, Oracle10g, ojdbc14.jar, JDK 1.5.0_14

Mario


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2008 7:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I think to recall that Oracle does not map NUMBER to java.sql.type.Types.NUMERIC but something else.

Look in the logs to see what is actually being reported.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2008 9:04 am 
Newbie

Joined: Thu Nov 13, 2008 8:21 am
Posts: 8
Ok, I agree.

If I try to change now from

Code:
<sql-type jdbc-type="NUMERIC" precision="32" not-null="false" hibernate-type="java.lang.Long" />

to

Code:
<sql-type jdbc-type="NUMBER" precision="32" not-null="false" hibernate-type="java.lang.Long" />

I get the following error

Code:
org.hibernate.MappingException: jdbc-type: NUMBER is not a known JDBC Type nor a valid number


Which jdbc-type is compatibel to SQL NUMBER(32,0) and will be identified properly?

Mario


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2008 10:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i dont have a oracle installation with me right now.

enable debug logging and the logs should tell you which type it is actually looking up for.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2008 10:15 am 
Newbie

Joined: Thu Nov 13, 2008 8:21 am
Posts: 8
The solution is:

Code:
<type-mapping>
    <sql-type jdbc-type="DECIMAL" precision="32" not-null="true" hibernate-type="java.lang.Long" />
    <sql-type jdbc-type="DECIMAL" precision="1" hibernate-type="java.lang.Byte" />
</type-mapping>


The second mistake was the value for the attribute not-null="false" in the first line which should be "true" instead.

This works fine for my problem.

Thx for the support!

Mario


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.