Cannot insert into Database Blob using IBATIS DAO
-------------------------------------------------
Key: IBATIS-309
URL: http://issues.apache.org/jira/browse/IBATIS-309
Project: iBatis for Java
Type: Bug
Components: SQL Maps, DAO
Versions: 2.1.7
Environment: Windows 2000, Oracle Application Server and latest version of
IBATIS
Reporter: sunil kumar
I am using Oracle Application Server 10g(9.0.4.0.0) with latest version of
IBatis. I am uploading a file and inserting file data as byte[] in the database
field which is a Blob. I keep on getting SQLException:Data size bigger than max
size for this type when i try to insert. If i take out the file data from my
insert statement , a record is inserted into the table.
My xml mapping file is:
code:
--------------------------------------------------------------------------------
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd"> <sqlMap namespace="testblob">
<typeAlias alias="testForm" type="gov.usaid.testblob.domain.TestForm" />
<resultMap id="testFileResult" class="testForm"> <result
property="fileId" column="FILE_ID" /> <result property="fileType"
column="FILE_TYPE" /> <result property="fileName"
column="FILE_NAME" /> <result property="fileData"
column="FILE_DATA" jdbcType="BLOB"/> <result property="fileSize"
column="FILE_SIZE"/>
</resultMap> <!-- <select id="downloadFile" resultMap="testFileResult"
parameterClass="string"> select * from test_file where
file_id=#value# </select>--> <insert id="saveFile"
parameterClass="testForm"> <selectKey resultClass="int"
keyProperty="fileId"> select SQ_REF_FILE_ID.nextval as
FILE_ID from dual </selectKey> insert into TEST_FILE
(FILE_ID,FILE_TYPE,FILE_NAME,FILE_SIZE,FILE_DATA) values (#fileId#,
#fileType:VARCHAR#, #fileName#, #fileSize#,#fileData#) </insert>
</sqlMap>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira