架构实例
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
">
<bean id="dataSource" value="${batch.jdbc.driver}" />
<property name="url" value="${batch.jdbc.url}" />
<property name="username" value="${batch.jdbc.user}" />
<property name="password" value="${batch.jdbc.password}" />
</bean>
<!--
<bean id="dataSource"
p:dataSource-ref="dataSource"/>
<!-- 定义了两个TransActionManager 一个是JDBC 一个是Hibernate。 绝大多数Job 目前都用Hibernate。 目前只有对账Job 用的Jdbc -->
<bean id="transactionManager" lazy-init="true">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="sessionFactory" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>com.cpic.a2.**.vo</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="use_outer_join">true</prop>
<prop key="statement_cache.size">0</prop>
<prop key="jdbc.use_scrollable_resultset">true</prop>
<prop key="cglib.user_reflection_optimizer">false</prop>
<prop key="jdbc.batch_size">200</prop>
<prop key="hibernate.connection.release_mode">auto</prop>
<prop key="hibernate.default_batch_fetch_size">10</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<!-- <prop key="javax.persistence.validation.mode">none</prop> -->
</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean />
</entry>
</map>
</property>
</bean>
<tx:annotation-driven transaction-manager="hibernateTransactionManager" />
<bean id="hibernateTransactionManager" ref="sessionFactory" />
</bean>
<bean id="baseDao" ref="sessionFactory" />
</bean>
</beans>