본문 바로가기

Language/C#

iBatis에서의 CLOB, BLOB 처리


iBatis에서 Oracle CLOB, BLOB 넣고 빼기 
 
우선 자바빈의 경우
  1. class Data{  
  2.     byte[] blobField;  
  3.     String clobField;  
  4. }  



데이터 Insert시 insert into table values( #blobField:BLOB#, #clobField:CLOB#) 로 넣으면 됨. 파리미터 맵을 써도 됨.
 
데이터 select 시 select blob, clob from table에서 resultClass로는 안 받아짐.
따로 resultMap을 써서 아래와 같은 매핑이 필요
 
<resultMap id="result" class="beanClassName">
  <result property="clobField" column="clobField" jdbcType="CLOB"/>
  <result property="blobField" column="blobField" jdbcType="BLOB"/>
</resultMap>

출처: http://wonsama.tistory.com/101