需要取出oracle库中long raw类型的数据并保存为文件(用spring+ibatis),
oracle库中字段为long raw类型,我用byte[]映射该字段,报错'流已被关闭',用java.sql.Blob,报错'类型不匹配',
现在配置:
sqlMap.xml中:
<resultMap id="fileResult" class="UpLoadFile">
<result property="material_id" column="MAT_ID" />
<result property="material_content" column="MATERIAL_CONTENT"
typeHandler="org.springframework.orm.ibatis.support.BlobByteArrayTypeHandler"/>
<result property="fileName" column="MATERIAL_NAME" />
<result property="apply_num" column="APPLY_NUM" />
</resultMap>
spring(applicationContext.xml)中:
<bean id="lobHandler"
class="org.springframework.jdbc.support.lob.DefaultLobHandler"/>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource" ref="dataSource2"></property>
<property name="configLocation">
<value>
classpath:com/fangdi/caseflow/persistence/sqlMapConfig2.xml
</value>
</property>
<property name="lobHandler" ref="lobHandler"/>
</bean>
请问我应该用什么类型来匹配该字段如何配置具体的sqlMapConfig2.xml和spring(applicationContext.xml)和其它文件?
oracle库中字段为long raw类型,我用byte[]映射该字段,报错'流已被关闭',用java.sql.Blob,报错'类型不匹配',
现在配置:
sqlMap.xml中:
<resultMap id="fileResult" class="UpLoadFile">
<result property="material_id" column="MAT_ID" />
<result property="material_content" column="MATERIAL_CONTENT"
typeHandler="org.springframework.orm.ibatis.support.BlobByteArrayTypeHandler"/>
<result property="fileName" column="MATERIAL_NAME" />
<result property="apply_num" column="APPLY_NUM" />
</resultMap>
spring(applicationContext.xml)中:
<bean id="lobHandler"
class="org.springframework.jdbc.support.lob.DefaultLobHandler"/>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource" ref="dataSource2"></property>
<property name="configLocation">
<value>
classpath:com/fangdi/caseflow/persistence/sqlMapConfig2.xml
</value>
</property>
<property name="lobHandler" ref="lobHandler"/>
</bean>
请问我应该用什么类型来匹配该字段如何配置具体的sqlMapConfig2.xml和spring(applicationContext.xml)和其它文件?