Ibatis 支持COLB 类型
来源:互联网 发布:sqsx免费代理软件 编辑:程序博客网 时间:2024/06/04 05:51
第一步 : spring配置文件配置 <!-- clob字段处理配置开始--> <bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor" lazy-init="true"/> <!-- LobHandler for Oracle JDBC drivers --> <!-- (refers to the NativeJdbcExtractor above to get access to native OracleConnections) --> <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" lazy-init="true"> <property name="nativeJdbcExtractor"><ref local="nativeJdbcExtractor"/></property> </bean> <!-- clob字段处理配置结束 --> <!-- iBATIS 配置 add by jsw 2013-06-17 --><bean id="sqlMapClient"class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"><property name="configLocation"><value>classpath:SqlMapConfig.xml</value></property><property name="dataSource"><ref local="dataSource" /></property> <!-- clob字段处理配置 --> <property name="lobHandler"><ref local="oracleLobHandler"/></property> </bean> 第二步: ibatis配置文件 配置<!-- 加入类型映射 colb --><typeHandler jdbcType="CLOB" javaType="java.lang.String" callback="org.springframework.orm.ibatis.support.ClobStringTypeHandler" /> 第三步 在 具体的 sqlmap 的 resultMap文件中配置<resultMap id="tproductBean" class="tproduct" > <result column="product_id" property="productId" jdbcType="VARCHAR" /> <result column="product_number" property="productNumber" jdbcType="DECIMAL" /> <result column="product_criterion_subtype" property="productCriterionSubtype" jdbcType="VARCHAR" /> <result column="product_sub_type_three" property="productSubTypeThree" jdbcType="VARCHAR" /> <result column="PRODUCT_contact_text" property="productContactText" jdbcType="CLOB" /> </resultMap>