-->
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: Overriding Default Hibernate Types
PostPosted: Thu Sep 23, 2004 11:09 am 
Beginner
Beginner

Joined: Thu May 27, 2004 3:07 pm
Posts: 20
Hibernate version: 2.1

Is there a way to force hibernate to use a UserType in place of a built in type by default? Basically, I have a user type for String objects which deals with Oracle issues related to not supporting empty strings. The user type basically plugs in a char(0) when an empty string is passed, and reads in an empty string when char(0) comes back from the database.

I'd like to have hibernate automatically use this for all String properties.

Is there a way to accomplish this, or do I have to put it in the mapping for every type?
Any solution where I can accomplish this in one place would be fine.

Thanks in advance for the help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 23, 2004 7:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
You'd have to write a customization of the net.sf.hibernate.type.TypeFactory class. Specifically, check out the static "BASIC_TYPES" Map.


Top
 Profile  
 
 Post subject: TypeFactory
PostPosted: Fri Sep 24, 2004 7:23 am 
Beginner
Beginner

Joined: Thu May 27, 2004 3:07 pm
Posts: 20
But I would have to alter the hibernate.jar from what i can tell to plug in a new TypeFactory.

That being said, i'm willing to make changes to TypeFactory to allow a user to specify default types for certain java classes.


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.