-->
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: Problems with empty and null values in Oracle
PostPosted: Tue Dec 08, 2009 3:59 pm 
Beginner
Beginner

Joined: Tue Mar 17, 2009 12:19 pm
Posts: 22
Using Hibernate 3.3.1, I'm having problems inserting or selecting either empty or null values with Oracle. This seems to occur in both SessionImpl and StatelessSession, though I'm working mainly with Stateless. Queries that work fine with MSSQLServer are not in Oracle 10g. Example:

(SessionImpl & HQL)
Code:
_sessionImpl.createQuery("SELECT o FROM Object o WHERE o.language=:myLanguage").setParameter("myLanguage", locale.getLanguage()).list();

where .getLanguage() returns a zero length string -- ""

(or the same thing in StatelessSession & SQLQuery)
Code:
SELECT language FROM Table where field = ""


The above queries work with SQLServer but return no records in Oracle unless I explicitly add a space:
Code:
SELECT language FROM Table where field = " "


And inserting/updating like this works in SQLServer:
Code:
UPDATE Table SET field =:myValue
(where :myValue is any java object with a value of NULL)

But with Oracle throws:

java.sql.SQLException: ORA-00932: inconsistent datatypes: expected NUMBER got BINARY


I have adjusted the Dialect to use both of the following classes with no difference.

org.hibernate.dialect.OracleDialect
org.hibernate.dialect.Oracle9Dialect

What am I missing here? I thought Hibernate and the JDBC driver would manage these cases.

Thanks!


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.