-->
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.  [ 2 posts ] 
Author Message
 Post subject: override default types
PostPosted: Wed Dec 15, 2004 2:54 pm 
Newbie

Joined: Wed Dec 15, 2004 2:38 pm
Posts: 1
hi-

I have a strange situation in my mysql database where I have a char(1) column with an empty string in some rows. The default java.lang.Character type will throw a StringIndexOutOfBoundsException for these empty strings. I logged a bug to just change the empty strings to nulls for the default CharacterType, but it was rejected on the grounds that empty strings are not really characters at all and so the CharacterType class shouldn't handle them. I was told to write a custom user type to handle it, which is fine by me.

Since the empty strings were generated by a legacy app that will be running alongside my new hibernate app, I need to use this custom type for all char(1) columns in my database, at least 60 places currently. I'd like to have hibernate map java.lang.Character to my custom type by default, instead of having to add my custom type for each character, which is error-prone.

Is there a way to do this? I looked in the source code, and the TypeFactory class seems designed to prevent this. Is there a way to do it?

Hibernate version: 2.1.7

Bug reference:
http://opensource.atlassian.com/project ... se/HB-1355


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 15, 2004 3:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No, currently there is no way.


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