-->
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: Use empty string instead of null on optional many-to-one
PostPosted: Mon Oct 04, 2004 7:57 am 
Newbie

Joined: Mon Oct 04, 2004 7:13 am
Posts: 19
When I have an optional foreign key relationships eg Customer has Timezone, then if a customer does not have a timezone, it gets stored on the DB as a padded empty string (ie it is Never null). In the O/R tool I use at the moment (jaxor) I map this onto a Timezone.NULL_CODE. Every customer therefore has a non-null Timezone.

I'm now plugging-in Hibernate in place or jaxor and wonder how to achieve the above.

many-to-one doesn't work because it tries to lookup the blank Timezone and of course throws UnresolvableObjectException.

Is my only option a UserType, where I test for blanks, and perform the lookup myself?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 7:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
use a UserType


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.