java+mybatis获取oracle存储的blob对象
1.创建用于接收blob类型的实体类
1@Getter 2@Setter 3publicclass FileEntity implements Serializable { 4privatestaticfinallong serialVersionUID = -5544560514334406226L; 5//附件类型6private String fileType;
7//附件
8privatebyte[] blob;
9 }
2.在mybaits xml 文件中 配置resultMap
1<resultMap id="fileResultMap" type="com.domains.entity.FileEntity">2<result column="BB10" property="fileType"></result>
3<result column="FJ" property="blob" jdbcType="BLOB" typeHandler="org.apache.ibatis.type.BlobTypeHandler"></result>
4</resultMap>
3.SQL语句
1<select id="getBlob" resultMap="fileEntityResultMap">2 select BB10,FJ from cb10 where cb100=#{uuid}
3</select>
blob 类型或被
org.apache.ibatis.type.BlobTypeHandler 转换成 byte[] 并赋值给实体类
以上是 java+mybatis获取oracle存储的blob对象 的全部内容, 来源链接: utcz.com/z/533652.html