-->
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: Empty string / null values in Oracle 9
PostPosted: Thu Apr 07, 2005 1:38 pm 
Regular
Regular

Joined: Fri Aug 29, 2003 12:48 pm
Posts: 63
Hey guys. I'm having some good times here with Oracle 9 and Hibernate 2. Turns out that when you store an empty string in a varchar column in Oracle, Oracle stores a null for you instead. This creates fun havoc with hibernate's dirtiness check, resulting in a lot of unnecessary database traffic.

Yes, I know this is a misbehavior in Oracle. Question is, what do folks do to work around this? Answers seem to include developing a simple custom UserType or whatever, or patching the getters for all string values which might ever be empty to read something like:

Code:
    public String getPath() {
        return "".equals(path) ? null : path;
    }


Any other bright ideas? Any notion what the "best" solution is?


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.