Oracle and empty strings
843859Apr 25 2010 — edited Apr 27 2010Hi All,
i'm porting my application to Oracle and i'm experiencing (big) issues since empty strings are treated as null by Oracle.
This is a big issue for me since my application uses empty and null values as two different things (indeed they are different !!), ie, i'm not having null pointer exception, but wrong behavior.
I'm thinking what's the best approach to follow since my appl. must work also on mysql and postgres.
Three options at the moment:
1. implement a jdbc wrapper that converts any empty string in something like '~'.
2. using aspectj, add some aspects to setString/getString converting any empty string in something like '~'.
3. buy a commercial driver that makes difference between empty and null (using aforementioned approaches ?).
I think that this difference in Oracle is really an impediment in doing applications db neutral and I'd like to ask your opinion about the best solution (if someone already resolved it as i guess).
Does anyone know if there are commercial jdbc driver that can help me ?
Does anyone know how ORM frameworks (like hibernate) handle this case ?
Thanks in advance
ste