-->
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: Null values that are not null
PostPosted: Wed Mar 10, 2010 8:57 am 
Newbie

Joined: Wed Mar 10, 2010 8:47 am
Posts: 4
Maybe the title is a little bit confusing, but I hope you read it anyway.
I am working on some legacy data right now that is also used by other programs or scripts, so I am not always able to make changes to the tables.
A problem that occured today: Object X can have one Object Y. Object Y doesn't need to be aware of the many X that can be related to it.
Not every X has an Y, but this is not expressed by a NULL value. Instead the field is filled with zeroes.
This time nothing else was dependend on those zeroes and I was able to allow null values, but that might not always be possible.
So what is the best solution to handle such a case? Internally in my program I would like to handle it as a null value.
On load I can set "not-found=ignore", but what should I do when saving? A possibility I thought of would be to create a dummy Y, persist X and delete the Y without cascading.
I guess that no solution is really clean is such a case, but the one I thought of seems very bad.
Is there a way to tell Hibernate that some special value should always be handled like NULL?

Thanks for your input!


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.