-->
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.  [ 2 posts ] 
Author Message
 Post subject: Null value in DB2 results in errorcode -4220
PostPosted: Mon May 25, 2009 8:39 am 
Newbie

Joined: Mon May 25, 2009 3:10 am
Posts: 2
Hi,

I'm having an issue with null values in a DB2 database. I'm trying to read a 'SupplierPerson' from the database using:

Code:
public class SupplierPersonDAOHibernateImpl extends HibernateDaoSupport implements SupplierPersonDAO
public List findSupplierFromParameters(String name, String firstName, String custStreet) throws DAOException {
      try {

         Object values[] = new Object[3];
values[0] = name;
values[1] = firstname;
values[2] = custStreet;
         
         return getHibernateTemplate().findByNamedQuery("supplierPerson.findSupplierFromParameters", values);
      } catch (DataAccessException e) {
         throw new DAOException(e);
      }
   }


Code:
<class name="SupplierPerson" table="SOCTAR_FROM_SUPPLIER_TEST">
      <id name="custid" type="string" column="CUSTID" />
      <property name="name" type="string" column="NAME"/>
      <property name="firstname" type="string" column="FIRSTNAME"/>
      <property name="custStreet" type="string" column="CUSTSTREET"/>
      <property name="street" type="string" column="STREET"/>
</class>


And the query

Code:
<query name="supplierPerson.findSupplierFromParameters"><![CDATA[from SupplierPerson where name like ? and firstName like ? and custStreet like ?]]></query>


When one of the properties is 'null' in the database, I get this error:

Code:
Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null; nested exception is com.ibm.db2.jcc.a.SqlException: [jcc][t4][1065][12306][3.52.95] Caught java.io.CharConversionException.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null


I don't understand why a null value seems to be such a problem.... If someone could help me...


Top
 Profile  
 
 Post subject: Re: Null value in DB2 results in errorcode -4220
PostPosted: Tue May 26, 2009 8:18 am 
Newbie

Joined: Mon May 25, 2009 3:10 am
Posts: 2
Ok,

I got the problem tracked down, the DBVisualer (to consult the DB2 Database) shows (null) values, but in fact there is a field in the database which has special characters in it such as é,è,à,ë,....

It seems that the com.ibm.db2.jcc.DB2Driver has a problem with it and it has nothing to do with Hibernate....


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