1.值类中的定义:
clob类型定义成String,blob类型定义成byte[]类型。
2.ibatis文件中的处理:
﹤typeHandler jdbcType="CLOB" javaType="java.lang.String"
llback="org.springframework.orm.ibatis.support.ClobStringTypeHandler" /﹥
blob类型:
<result property="foodImage" column="FOOD_IMAGE" typeHandler="org.springframework.orm.ibatis.support.BlobByteArrayTypeHandler"/﹥
﹤/resultMap﹥
3.spring配置文件:
﹤bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"﹥
﹤property name="configLocation" value="classpath:conf/sqlMapConfig.xml"﹥﹤/property﹥
﹤property name="dataSource"﹥﹤ref local="aeqdsDataSource" /﹥﹤/property﹥
﹤property name="lobHandler"﹥﹤ref local="oracleLobHandler" /﹥﹤/property﹥
﹤/bean﹥
本文介绍了如何在iBatis中处理CLOB和BLOB类型的字段。具体包括将CLOB类型映射为Java中的String类型,BLOB类型映射为byte[]类型的方法,并详细展示了在iBatis配置文件及Spring配置文件中的具体实现。
1332

被折叠的 条评论
为什么被折叠?



