ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ChippyJoey <cowen...@earthlink.net>
Subject Ibatis 3 Insert Error
Date Sun, 31 Jan 2010 22:03:31 GMT

Hi –

I am new to Ibatis and I have run into an issue regarding inserts into a
table. I am getting the following error when I attempt to insert data into a
table:

DEBUG [main] - Checked out connection 14247087 from pool.
DEBUG [main] - ooo Connection Opened
DEBUG [main] - ==>  Executing: insert into dbo.[Key] (KeyId, KeyValue)
values (?, ?) 
DEBUG [main] - ==> Parameters: 1(String), Test 147(String)
java.lang.ClassCastException: java.lang.Integer
      at $Proxy4.insertKey(Unknown Source)
      at com.catalog.model.dao.impl.KeyImpl.insertKey(KeyImpl.java:21)
      at com.catalog.appl.Import.addKey(Import.java:74)
      at com.catalog.appl.Import.importFiles(Import.java:33)
      at com.catalog.appl.Import.main(Import.java:204)
DEBUG [main] - xxx Connection Closed
DEBUG [main] - Returned connection 14247087 to pool.

The table that I am attempting to insert into has the following definition:

CREATE TABLE [dbo].[Key](
      [KeyId] [nchar](10) NULL,
      [KeyValue] [nchar](10) NULL
) ON [PRIMARY]

I am using the following SQL map for inserts into the Key table:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="com.catalog.model.dao.KeyMapper">
  <insert id="insertKey" parameterType="com.catalog.model.Key">
    insert into dbo.[Key]
       (KeyId, KeyValue)
   values

       (#{keyid}, #{keyvalue})   
  </insert>
</mapper>

I have the following environment:

Ibatis 3 (ibatis-3-core-3.0.0.227.jar)
Java 1.5
SQL Server 2008 Express

Whats interesting about the error is that the Key table does not even have
an Integer type that could cause a casting problem. I am wondering if the
casting issue is occurring as a result of Ibatis attempting to handle the
row count after the insert has completed (i.e. 1 row inserted). I am sure I
am doing something wrong but I am not sure what it is. Any help would be
greatly appreciated.

Thanks in advance.

- Chip

-- 
View this message in context: http://old.nabble.com/Ibatis-3-Insert-Error-tp27397120p27397120.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message