-->
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: interpreting 0 value as null
PostPosted: Tue Jan 13, 2009 3:58 pm 
Newbie

Joined: Tue Jan 13, 2009 3:52 pm
Posts: 1
We work with a legacy database where foreign keys contain 0 instead of null. Is there a way to make Hibernate interpret 0 as null for certain fields?

Thank you,
-I


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2009 4:59 pm 
Regular
Regular

Joined: Tue Dec 30, 2008 8:14 pm
Posts: 50
formula with a case statement may work.

---
please rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2009 3:37 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Another option is to implement a custom UserType that does the 0<->null translation. You can find some information here: http://www.hibernate.org/hib_docs/v3/re ... pes-custom


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.