-->
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: JPA null parameter binding fails for Long type
PostPosted: Mon Jan 28, 2008 11:38 am 
Newbie

Joined: Mon Jan 28, 2008 11:06 am
Posts: 2
Location: Netherlands
Hi,

I am using the JPA provided by Hibernate 3.2.4. I am trying to call a stored procedure with a numeric parameter where the value of the parameter is null.

Java code (both properties are java.lang.Long):
entityManager.createNamedQuery("insertVsAPRecord")
.setParameter(1, data.getId())
.setParameter(2, data.getSubsRefNum())
.executeUpdate();

Hibernate mapping:
<hibernate-mapping package="nl.tele2.agent.ixi.domain">
<sql-query name="insertVsAPRecord" callable="false">
{ call pck.ins_record(?, ?) }
</sql-query>
</hibernate-mapping>

Oracle package pck:
PROCEDURE ins_record (
p_payload_id IN NUMBER(10)
, p_subsrefnum IN NUMBER(10)
);

When I call the stored procedure with values for the properties in the data object, it works fine. When one or both properties are null, it fails with an Oracle error:

Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:59)
at nl.tele2.agent.ixi.IxiReceiver.insertIxiData(IxiReceiver.java:226)
... 20 more
Caused by: org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:174)
at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1163)
at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:334)
at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:50)
... 21 more
Caused by: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'INS_RECORD'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


When I use the Hibernate Session and execute with the same data it works.

Java code with Hibernate session:
hibernateSession.getNamedQuery("insertVsAPRecord")
.setParameter(0, data.getId())
.setParameter(1, data.getSubsRefNum(), new LongType())
.executeUpdate();

I this a bug in the JPA implementation by Hibernate?


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

Hibernate version:3.2.4
Mapping documents:Java 5 JPA
Name and version of the database you are using:Oracle 9i


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.