-->
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.  [ 7 posts ] 
Author Message
 Post subject: Custom Null Types
PostPosted: Fri Jan 21, 2005 8:50 pm 
Newbie

Joined: Thu Aug 19, 2004 10:52 am
Posts: 14
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
hibernate 3

I am trying to put in a special 'NULL' type for a property. By this, I mean that the database I am working with is a legacy system which uses '0' as meaning NULL.

I would like to find a generic solution to this so that I don't have to write custom types everytime that this happens, and that the createSchema does not create foreign keys for this columns, since obviously they are meaningless.

Is there a way of doing this?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 22, 2005 6:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No, not without UserTypes and also very difficult for associations.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 22, 2005 1:46 pm 
Newbie

Joined: Thu Aug 19, 2004 10:52 am
Posts: 14
If I were to add this functionality, could it incorporated into the main code base, or does it go against some philosophy?

I don't think that it would be necessary for assoiciations, since in general, even in a legacy db, the row would just not be there.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 22, 2005 1:53 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Three-valued logic is inappropriate for a data model (SQL shows that fairly well in its weirdness with NULLs) and a faked three-valued logic doesn't make it better. Nothing about philosophy, just data management basics.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 22, 2005 2:47 pm 
Newbie

Joined: Thu Aug 19, 2004 10:52 am
Posts: 14
True - I am not arguing that this is remotely a good thing, but given the prevalence of legacy databases, wouldn't it be useful?

I mean, composite-keys are idiotic as well, but one of the reasons that I choose Hibernate was because of its support for bizarre legacy models.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 22, 2005 2:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This can already be done with some effort - there is an old forum thread about it, search for it. Most likely this won't get any more supported.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 22, 2005 3:08 pm 
Newbie

Joined: Thu Aug 19, 2004 10:52 am
Posts: 14
ok - I found them. I looked yesterday, but obviously I wasn't typing in the right thing:

http://forum.hibernate.org/viewtopic.ph ... highlight=

http://forum.hibernate.org/viewtopic.ph ... key+legacy

Thanks for all the help.


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