You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Stephen Friedrich <st...@fortis-it.eu> on 2010/01/25 13:54:59 UTC

resultType="byte[]"

Is there a way to directly return a byte[] result (reading from a blob column)?

This works fine:
XML:
    <select id="selectContent" resultType="com.acme.ByteArrayDto">
        select content from manual where key = #{key,jdbcType=VARCHAR}
    </select>
Interface:
   ByteArrayDto selectContent(@Param("key") String key);
Groovy class:
   package com.acme.dtos
   class ByteArrayDto {
       byte[] content;
   }

However it would be nicer to do away with the DTO wrapper:
XML:
    <select id="selectContent" resultType="byte[]">
        select content from manual where key = #{key,jdbcType=VARCHAR}
    </select>
Interface:
   byte[] selectContent(@Param("key") String key);

Unfortunately that results in a "no class def found" for "byte[]".

Is there a way to make this work?