-->
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.  [ 4 posts ] 
Author Message
 Post subject: Update with null value with hibernate
PostPosted: Mon Oct 17, 2005 8:26 pm 
Newbie

Joined: Mon Oct 17, 2005 8:16 pm
Posts: 1
I am using hibernate 3, following is a hql that I am using for update

query = session.createQuery("update myTable set field1 =?, field2 = ? where id=?");
query.setParameters (0, value1);
query.setParameters(1, 'value2);
query.setParameters(2, idValue);

The field1 type in db is numeric and the problem is that when value1 is a java null pointer, hibernate throws exception like this:

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

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:626)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:182)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:630)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1081)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2905)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2977)
at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:76)


My question is that What's the right value for database NULL in HQL?

Thanks

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 12:07 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
It is the best that use classes (BigDecimal,Integer,Long) instead primitive for number datatype


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 15, 2006 9:42 am 
Regular
Regular

Joined: Wed Mar 08, 2006 2:07 am
Posts: 50
Location: Bangalore
snpesnpe wrote:
It is the best that use classes (BigDecimal,Integer,Long) instead primitive for number datatype


I have tried it ... but it doesnt work for me... any other ideas that you think could work .... plz i need to get it work very badly...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 30, 2008 10:36 am 
Newbie

Joined: Wed Jan 30, 2008 10:15 am
Posts: 1
I have this problen when I use Oracle.

in this HQL:

from entity e
where
:userOID in elements(e.operators)

if "userOID" is null returns: ORA-00932: inconsistent datatypes: expected BINARY got NUMBER

Hibernate sets the parameter as serialized type.

tks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.