I have an existing DB2 table (EVENT_HISTORY) to which I've mapped the object
Request (see below). This table has a LONG VARCHAR column that corresponds
to Request.text.
When I try to use db.update(request) to update a Request that has been
modified, I get the following error from DB2:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/6000] SQL0401N The
data types of the operands for the operation "=" are not compatible.
SQLSTATE=42818
After some investigation, it turns out that the LONG VARCHAR is showing up
in the WHERE clause generated by Castor and this causes the above error.
Is there a way to work around this?
Thanks in advance.
Brad Beck
Lead Software Engineer, TLR BIS
Phone: 651.848.2401
[EMAIL PROTECTED]
EVENT_HISTORY (DB2 Table)
-------------
eh_session_id CHAR(32) NOT NULL \
eh_event_seq_num NUMERIC(7) NOT NULL |- Primary Key
eh_user_id CHAR(32) NOT NULL /
..................
eh_event_type CHAR(18) NOT NULL
eh_event_ver_code CHAR(2) NOT NULL
eh_event_timestamp TIMESTAMP NOT NULL
eh_event_data LONG VARCHAR NOT NULL
eh_event_source CHAR(7) NOT NULL
eh_msg_queue_name VARCHAR(50) NOT NULL
eh_process_name VARCHAR(40) NOT NULL
eh_ins_timestamp TIMESTAMP NOT NULL
eh_status_code CHAR(1) NOT NULL
Request (Corresponding Java Object)
-------
public class Request {
protected String eventType;
protected String srcId;
protected String eventVer;
protected String sessGuid;
protected String userGuid;
protected Date date;
protected Date insertDate;
protected int sequenceNbr;
protected String text;
protected String queueName;
protected String status;
protected String processName;
// ... Getter/setters removed for brevity
}
Requestmapping.xml
------------------
<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version
1.0//EN" "http://castor.exolab.org/mapping.dtd">
<mapping>
<class name="com.tlr.onlinecharges.session.misc.Request"
identity="sessGuid sequenceNbr userGuid">
<description>Event History</description>
<map-to table="dcdetail.event_history"/>
<field name="sessGuid" type="string" required="true">
<sql name="eh_session_id" type="char"/>
</field>
<field name="sequenceNbr" type="integer" required="true">
<sql name="eh_event_seq_num" type="numeric"/>
</field>
<field name="userGuid" type="string" required="true">
<sql name="eh_user_id" type="char"/>
</field>
<field name="eventType" type="string" required="true">
<sql name="eh_event_type" type="char"/>
</field>
<field name="eventVer" type="string" required="true">
<sql name="eh_event_ver_code" type="char"/>
</field>
<field name="date" type="date" required="true">
<sql name="eh_event_timestamp" type="timestamp"/>
</field>
<field name="insertDate" type="date" required="true">
<sql name="eh_ins_timestamp" type="timestamp"/>
</field>
<field name="text" type="string" required="true">
<sql name="eh_event_data" type="longvarchar"/>
</field>
<field name="srcId" type="string" required="true">
<sql name="eh_event_source" type="char"/>
</field>
<field name="queueName" type="string" required="true">
<sql name="eh_msg_queue_name" type="char"/>
</field>
<field name="processName" type="string" required="true">
<sql name="eh_process_name" type="char"/>
</field>
<field name="status" type="string" required="true">
<sql name="eh_status_code" type="char"/>
</field>
</class>
</mapping>
requestdatabase.xml
-------------------
<!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version
1.0//EN"
"http://castor.exolab.org/jdo-conf.dtd">
<database name="dcdt" engine="db2" >
<data-source class-name="COM.ibm.db2.jdbc.DB2DataSource">
<params user="dcuser" password="..." database-name="dcdt" />
</data-source>
<mapping href="requestmapping.xml" />
</database>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev