-->
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: Insert query fail with parameter value binding
PostPosted: Thu Aug 06, 2009 4:16 pm 
Newbie

Joined: Thu Aug 06, 2009 3:26 pm
Posts: 1
Hi,
I am using hibernate with jpa and spring with db2 zos. The dialect used is DB2390Dialect. My application is deployed on WAS 6.1 and that is installed on AIX. in WAS i am using the XA datasource to connect the database. I am using jtatransactionmanager(i,e was6.1 transactions) for transtactionality. The problem is insert query fails with the NullPointerException. The info message it shows is here. It says could not bind value 'y27x51' to parameter: 1; null. The database type for corresponding column(that of parameter 1) is char of length 10.

2009-08-05 09:51:35,958 [WebContainer : 2] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2009-08-05 09:51:35,958 [WebContainer : 2] DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection
2009-08-05 09:51:35,958 [WebContainer : 2] DEBUG com.hcsc.cob.integration.util.Audit - insert into YYY.CAR(ID, LST_ID, LST_DT, CD, ST_CD, CRTE_DT, NM, PNM, PHN_NBR) values (default, ?, ?, ?, ?, ?, ?, ?, ?)
2009-08-05 09:51:35,959 [WebContainer : 2] DEBUG org.hibernate.SQL - insert into XXX.CAR(ID, LSTUSR_ID, DATE_L, BU_CNT, BL_CD, CRDT, ORG, NM, PHNNBR) values (default, ?, ?, ?, ?, ?, ?, ?, ?)
2009-08-05 09:51:35,959 [WebContainer : 2] INFO org.hibernate.type.StringType - could not bind value 'i27751' to parameter: 1; null
2009-08-05 09:51:35,959 [WebContainer : 2] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2009-08-05 09:51:35,959 [WebContainer : 2] DEBUG org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
2009-08-05 09:51:35,959 [WebContainer : 2] DEBUG org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]

But the insert query fired on the same database works fine when the same application ear deployed on WAS 6.1 which is installed on windows.

I went through the hibernate source code from which i can conclude this.

It is failing in the following method of NullableType.class. I guess its failing when executing the method call set( st, value, index );


public final void nullSafeSet(PreparedStatement st, Object value, int index)
throws HibernateException, SQLException {
try {
if ( value == null ) {
if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "binding null to parameter: " + index );
}

st.setNull( index, sqlType() );
}
else {
if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "binding '" + toString( value ) + "' to parameter: " + index );
}

set( st, value, index );
}
}
catch ( RuntimeException re ) {
log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + re.getMessage() );
throw re;
}
catch ( SQLException se ) {
log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + se.getMessage() );
throw se;
}
}


The above method simply does this.

public void set(PreparedStatement st, Object value, int index) throws SQLException {
st.setString(index, (String) value);
}

The log is printing both the index and value which are not null. Here i can only suspect preparedstatement object as null. I am not sure of this being null since i couldnt debug.


Can anybody please help is there any kind of problem with the datasource in WAS on AIX.
Thanks in Advance,
ginnuri


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.