-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem registering custom nvarchar2 column using @Type
PostPosted: Mon Oct 06, 2008 8:24 am 
Newbie

Joined: Mon Oct 22, 2007 9:26 am
Posts: 2
Hi,
I have a problem with defining custom mapping for a column. I want to define a custom column for Unicode strings, so I extended StringType as StringType2, and overrided getName to return "string2". I also extended Oracle10gDialect as follows to register my new type with code -999:

Code:
public class MyOracle10gDialect extends Oracle10gDialect {
   public MyOracle10gDialect() {
        registerHibernateType(-999, new HibernateString2().getName());
    }

    protected void registerCharacterTypeMappings() {
        super.registerCharacterTypeMappings();
        registerColumnType(-999, 255, "nvarchar2($l)");
    }
}


I added a @Type(type="string2") to a field in an entity which should hold nvarchar2 (Unicode) data.

Hibernate fails to create EntityManagerFactory because of the line @Type(type="string2"). I traced the problem and found that MyOracle10gDialect is never instantiated, so Hibernate doesn't understand what is string2. This is definitely a load-time-order issue, so how can I register my custom type before hibernate checks for @Type?

BTW, I'm using Hibernate 3.2.5.GA along with Spring 2.5 and Oracle 10g.

Mohsen.


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

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.