spring+hibernate保存blob类型(oracle9i)

 springContext.xml文件配置:

 

<bean id="nativeJdbcExtractor"
		class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor"
		lazy-init="true">
	</bean>

	<bean id="lobHandler"
		class="org.springframework.jdbc.support.lob.OracleLobHandler"
		lazy-init="true">
		<property name="nativeJdbcExtractor" ref="nativeJdbcExtractor" />
	</bean>

	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
				<property name="lobHandler" ref="lobHandler" />
</bean>

 

在oracle9i中,

<bean id="nativeJdbcExtractor"
class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor"
lazy-init="true">
</bean>

是必须的,若为oracle10g以上版本,不需要

 

hibernate配置:

<property name="blobData" column="BLOBDATA"
			type="org.springframework.orm.hibernate3.support.BlobByteArrayType" />

 Model类:

 

private byte[] blobData;

 
 

你可能感兴趣的:(spring,Hibernate,bean,jdbc,orm)