I am having a problem with the following lines in my mapping:
Code:
<property name="binderEffective" type="calendar"><meta attribute="use-in-tostring">true</meta>
<column name="BINDEREFFECTIVE" length="26" />
</property>
<property name="binderExpire" type="calendar"><meta attribute="use-in-tostring">true</meta>
<column name="BINDEREXPIRE" length="26" />
</property>
These columns are TIMESTAMP type. When I remove them from the hbm.xml file, the query works. I have tried using Calendar,Timestamp, java.sql.Timestamp, and Date -- all with the same error.
Hibernate version: 3.1
Mapping documents:Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jan 16, 2006 9:56:53 AM by Hibernate Tools 3.1.0 beta1JBIDERC2 -->
<hibernate-mapping>
<class name="Risk" table="RISK">
<id name="riskId" type="string">
<column name="RISKID" length="40" />
<generator class="assigned" />
</id>
<many-to-one name="Quote" class="Quote" fetch="select">
<column name="QUOTEID" length="11" />
</many-to-one>
<many-to-one name="risk" class="Risk" fetch="select">
<column name="RISKID" length="11" not-null="true" />
<column name="RISKIDREN" length="2" not-null="true" />
<column name="RISKIDEND" length="4" not-null="true" />
</many-to-one>
<property name="aboveGrndFlr" type="java.lang.Boolean"><meta attribute="use-in-tostring">true</meta>
<column name="ABOVEGRNDFLR" />
</property>
<property name="acvBldg" type="integer"><meta attribute="use-in-tostring">true</meta>
<column name="ACVBLDG" />
</property>
<property name="acvContents" type="integer"><meta attribute="use-in-tostring">true</meta>
<column name="ACVCONTENTS" />
</property>
<property name="addressId" type="string"><meta attribute="use-in-tostring">true</meta>
<column name="ADDRESSID" length="40" />
</property>
<property name="amtCv" type="integer"><meta attribute="use-in-tostring">true</meta>
<column name="AMTCV" />
</property>
<property name="bgeg" type="string"><meta attribute="use-in-tostring">true</meta>
<column name="BGEG" length="2" />
</property>
<property name="billingMethod" type="string"><meta attribute="use-in-tostring">true</meta>
<column name="BILLINGMETHOD" length="1" />
</property>
<property name="billingPlan" type="string"><meta attribute="use-in-tostring">true</meta>
<column name="BILLINGPLAN" length="1" />
</property>
<property name="binderEffective" type="calendar"><meta attribute="use-in-tostring">true</meta>
<column name="BINDEREFFECTIVE" length="26" />
</property>
<property name="binderExpire" type="calendar"><meta attribute="use-in-tostring">true</meta>
<column name="BINDEREXPIRE" length="26" />
</property>
<property name="binderIssued" type="java.lang.Boolean"><meta attribute="use-in-tostring">true</meta>
<column name="BINDERISSUED" />
</property>
<property name="binderNum" type="string"><meta attribute="use-in-tostring">true</meta>
<column name="BINDERNUM" length="11" />
</property>
<property name="bldgPhaseNum" type="string"><meta attribute="use-in-tostring">true</meta>
<column name="BLDGPHASENUM" length="15" />
</property>
<property name="boLaw" type="integer"><meta attribute="use-in-tostring">true</meta>
<column name="BOLAW" />
</property>
<property name="coinsuredName" type="string"><meta attribute="use-in-tostring">true</meta>
<column name="COINSUREDNAME" length="70" />
</property>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
String hql = "FROM Risk " +
"" +
"WHERE Risk.riskId = :riskId " +
"AND Risk.riskIdRen = :riskIdRen " +
"AND Risk.riskIdEnd = :riskIdEnd ";
try{
Query q = HibernateUtil.createCacheableQuery(hql);
q.setString("riskId", risk.getRiskId());
q.setString("riskIdRen", risk.getRiskIdRen());
q.setString("riskIdEnd", risk.getRiskIdEnd());
Risk Risk = (Risk)q.uniqueResult();
Full stack trace of any exception that occurs:Code:
[6/9/06 8:54:27:186 EDT] 72a7f211 SystemOut O 09 Jun 2006 08:54:27,186 WARN [Servlet.Engine.Transports : 0] (JDBCExceptionReporter.java:71) - SQL Error: -99999, SQLState: 22005
[6/9/06 8:54:27:186 EDT] 72a7f211 SystemOut O 09 Jun 2006 08:54:27,186 ERROR [Servlet.Engine.Transports : 0] (JDBCExceptionReporter.java:72) - [IBM][CLI Driver] CLI0112E Error in assignment. SQLSTATE=22005
org.hibernate.exception.DataException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2148)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:749)
Name and version of the database you are using:
DB2 UDB 8.1