-->
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: Configure the result of reverse-engineering .hbm.xml
PostPosted: Thu Mar 30, 2006 5:14 am 
Newbie

Joined: Thu Mar 30, 2006 4:53 am
Posts: 12
Hibernate version:3.1
Hibernate Tools version:3.1.0 beta4a
Name and version of the database:Oracle 10g

Hi,

i genarted the .hbm.xml document for a table via Hibernate Tools. Defined my own UserType OracleCHAR (defined on http://www.hibernate.org/90.html) and insert the reveng.xml the type mapping
Code:
<sql-type jdbc-type="CHAR" hibernate-type="mywork.OracleCHAR" />


The result is:

Code:
...
<key-property name="groupId" type="mywork.OracleCHAR">
  <column name="GROUP_ID" length="40" />
</key-property>
...


When i start a testprogram, i get an exception:
org.hibernate.MappingException: No Dialect mapping for JDBC type: 999
at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
at org.hibernate.dialect.Dialect.getTypeName(Dialect.java:216)
at org.hibernate.mapping.Column.getSqlType(Column.java:181)
at org.hibernate.mapping.Table.sqlTemporaryTableCreateString(Table.java:302)
at org.hibernate.mapping.PersistentClass.prepareTemporaryTables(PersistentClass.java:661)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:199)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
....

I changed the .hbm.xml by hand to:

Code:
...
<key-property name="groupId" type="mywork.OracleCHAR">
  <column name="GROUP_ID" sql-type="char" length="40" />
</key-property>
...


And my problem is solved.

What can i do, to generate the sql-type attribute via reverse engineering???


Thanks for help,

Michael


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 7:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Why is there something that returns 999 as the jdbc type ?

Is your usertype doing that ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 8:42 am 
Newbie

Joined: Thu Mar 30, 2006 4:53 am
Posts: 12
999 is the JDBC Type Oracle.FIXED_CHAR

I have fixed my problem, by creating my own Dialect.

Code:
public class OwnOracleDialect extends Oracle9Dialect {
  public OwnOracleDialect() {
    super();
    registerColumnType( 999, "mywork.OracleCHAR" );
  }
}


Thanks max for the question ;-)


Michael


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.