-->
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: CLOB column in DB2
PostPosted: Fri Jan 25, 2008 11:55 am 
Newbie

Joined: Fri Jan 25, 2008 11:48 am
Posts: 1
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


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.