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...