| Hi,
 I am using DB2 database and trying to insert a row into the table which has 1 column defined as CLOB. I am using annotated classes (hibernate annotation)
 
 The following is the query generated by Hibernate:
 
 insert into DM3.TBS_LIST_AUDIT (LOG_ID, CREATE_DATE, CREATE_USER, DATA, KEY_ID, TABLE_NAME) values (default, ?, ?, ?, ?, ?)
 
 The "DATA" is the column which is CLOB. But I get the following error:
 
 SQL Error: -301, SQLState: 07006: An input host variable cannot be used, because of its data type.
 
 I have defined the property as java.sql.Clob and setting the property as setData(Hibernate.createClob("some string"));
 
 The following is the annotation in persistent entity
 
 /**
 * @hibernate.property column="DATA" length="2000"
 */
 @Column(name = "DATA", length = 2000)
 public Clob getData() {
 return this.data;
 }
 
 public void setData(Clob data) {
 this.data = data;
 }
 
 The strange thing is If I use an hbm file which has the following property definition everything works fine:
 
 <property
 name="data"
 type="java.sql.Clob"
 column="DATA"
 length="2000"
 >
 <meta attribute="field-description">
 @hibernate.property
 column="DATA"
 length="2000"
 </meta>
 </property>
 
 What am I doing wrong? Please help me to solve the issue.
 
 Regards,
 Kiran
 
 
 |