<?xml version="1.0" encoding="GBK"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- ************************************************************************************************************************* -->
<!-- 定义数据源Bean,使用C3P0数据源实现 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<!-- 指定连接数据库的驱动 -->
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<!-- 指定连接数据库的URL -->
<property name="jdbcUrl" value="jdbc:mysql://localhost/a0121"/>
<!-- 指定连接数据库的用户名 -->
<property name="user" value="a"/>
<!-- 指定连接数据库的密码 -->
<property name="password" value="a"/>
<!-- 指定连接数据库连接池的最大连接数 -->
<property name="maxPoolSize" value="20"/>
<!-- 指定连接数据库连接池的最小连接数 -->
<property name="minPoolSize" value="1"/>
<!-- 指定连接数据库连接池的初始化连接数 -->
<property name="initialPoolSize" value="1"/>
<!-- 指定连接数据库连接池的连接的最大空闲时间 -->
<property name="maxIdleTime" value="20"/>
</bean>
<!--定义了Hibernate的SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>/hibernate-map-xml/AripBaseinfoOrg.hbm.xml</value>
<value>/hibernate-map-xml/Tlorrybaseinfo.hbm.xml</value>
<value>/hibernate-map-xml/Tlorrypp.hbm.xml</value>
<value>/hibernate-map-xml/Tlorrysjinfo.hbm.xml</value>
<value>/hibernate-map-xml/Tlorrystate.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<!-- 事务拦截器bean需要依赖注入一个事务管理器 -->
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributes">
<!-- 下面定义事务传播属性-->
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- ****************************************************************************************************************************** -->
<!-- 定义连接 GPS 服务器数据库 -->
<bean id="dataSourceGPS" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="jdbcUrl" value="jdbc:microsoft:sqlserver://111.225.0.21:1433"/>
<property name="user" value="wt"/>
<property name="password" value="w13"/>
<property name="maxPoolSize" value="20"/>
<property name="minPoolSize" value="1"/>
<property name="initialPoolSize" value="1"/>
<property name="maxIdleTime" value="20"/>
</bean>
<!--定义了Hibernate的SessionFactoryGPS -->
<bean id="sessionFactoryGPS" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSourceGPS"/>
<property name="mappingResources">
<list>
<value>/hibernate-map-xml/CarGjall.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
</props>
</property>
</bean>
<bean id="transactionManagerGPS" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactoryGPS"/>
</bean>
<bean id="transactionInterceptorGPS" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<!-- 事务拦截器bean需要依赖注入一个事务管理器 -->
<property name="transactionManager" ref="transactionManagerGPS"/>
<property name="transactionAttributes">
<!-- 下面定义事务传播属性-->
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!--车辆管理 ****************************************************************************************************************************** -->
<!-- 定义了 DAO dtbi dao tlorrybaseinfo imp -->
<bean id="dtbi" class="cn.arip.vm.dao.imp.imp_tlorrybaseinfo">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 定义了 DAO b_istate 通过id获取状态 ,比如: 机构代码 车辆品牌代码 车辆使用状态 代码 -->
<bean id="b_istate" class="cn.arip.vm.dao.imp.imp_tlorrystate">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 定义 公共 分页 程序 ********************************************************************************************************* -->
<bean id="pagerService" class="cn.arip.page.PagerService"/>
<!-- GPS管理 ********************************************************************************************************* -->
<bean id="dgps" class="cn.arip.gps.dao.imp.imp_gps">
<property name="sessionFactory" ref="sessionFactoryGPS" />
</bean>
<!-- 司机管理 -->
<bean id="dtsi" class="cn.arip.driver.dao.imp.imp_driver">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>
----------------------------------------------------------------------
----------------------------------------------------------------------
[u][b]经上面说明,我测试成功了[/b][/u]
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config/>
<context:component-scan base-package="com.eriching"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClass}"/>
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"/>
<property name="user" value="${jdbc.user}"/>
<property name="password" value="${jdbc.password}"/>
<property name="maxPoolSize" value="40" />
<property name="minPoolSize" value="1" />
<property name="initialPoolSize" value="1" />
<!--最大空闲时间,25000秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime" value="600" />
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement" value="5" />
<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
<property name="acquireRetryAttempts" value="30" />
<!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
<property name="acquireRetryDelay" value="1000" />
<!--连接关闭时默认将所有未提交的操作回滚。Default: false -->
<property name="autoCommitOnClose" value="false" />
<!-- 获取connnection时测试是否有效 -->
<property name="testConnectionOnCheckin" value="true" />
<!--每18000秒检查所有连接池中的空闲连接 -->
<property name="idleConnectionTestPeriod" value="60" />
<!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出
SQLException,如设为0则无限期等待。单位毫秒。Default: 0 -->
<property name="checkoutTimeout" value="3000" />
</bean>
<!--定义了Hibernate的SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- annotation -->
<!-- packagesToScan -->
<property name="packagesToScan">
<list>
<value>com.gxh.**.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="current_session_context_class">thread</prop>
<prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.use_outer_join">true</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.jdbc.batch_size">50</prop>
<prop key="hibernate.jdbc.fetch_size">50</prop>
<prop key="hibernate.generate_statistics">true</prop>
<!-- 二级缓存EHCache start -->
<prop key="hibernate.cache.user_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<!-- 查询缓存 -->
<prop key="hibernate.cache.use_query_cache">false</prop>
<!-- 二级缓存EHCache end-->
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.connection.characterEncoding">GBK</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
</props>
</property>
</bean>
<!-- 配置事务管理器 -->
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="dataSource2" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClass2}"/>
<property name="jdbcUrl" value="${jdbc.jdbcUrl2}"/>
<property name="user" value="${jdbc.user2}"/>
<property name="password" value="${jdbc.password2}"/>
<property name="maxPoolSize" value="40" />
<property name="minPoolSize" value="1" />
<property name="initialPoolSize" value="1" />
<!--最大空闲时间,25000秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime" value="25000" />
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement" value="10" />
<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
<property name="acquireRetryAttempts" value="30" />
<!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
<property name="acquireRetryDelay" value="1000" />
<!--连接关闭时默认将所有未提交的操作回滚。Default: false -->
<property name="autoCommitOnClose" value="false" />
<!-- 获取connnection时测试是否有效 -->
<property name="testConnectionOnCheckin" value="true" />
<!--每18000秒检查所有连接池中的空闲连接 -->
<property name="idleConnectionTestPeriod" value="60" />
<!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出
SQLException,如设为0则无限期等待。单位毫秒。Default: 0 -->
<property name="checkoutTimeout" value="3000" />
</bean>
<!--定义了Hibernate的SessionFactory -->
<bean id="sessionFactory2"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource2" />
<!-- annotation -->
<!-- packagesToScan -->
<property name="packagesToScan">
<list>
<value>com.gxh.**.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="current_session_context_class">thread</prop>
<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.use_outer_join">true</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.jdbc.batch_size">50</prop>
<prop key="hibernate.jdbc.fetch_size">50</prop>
<prop key="hibernate.generate_statistics">true</prop>
<!-- 二级缓存EHCache start -->
<prop key="hibernate.cache.user_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<!-- 查询缓存 -->
<prop key="hibernate.cache.use_query_cache">false</prop>
<!-- 二级缓存EHCache end-->
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.connection.characterEncoding">GBK</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
</props>
</property>
</bean>
<!-- 配置事务管理器 -->
<tx:annotation-driven transaction-manager="txManager2"/>
<bean id="txManager2" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory2"/>
</bean>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- ************************************************************************************************************************* -->
<!-- 定义数据源Bean,使用C3P0数据源实现 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<!-- 指定连接数据库的驱动 -->
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<!-- 指定连接数据库的URL -->
<property name="jdbcUrl" value="jdbc:mysql://localhost/a0121"/>
<!-- 指定连接数据库的用户名 -->
<property name="user" value="a"/>
<!-- 指定连接数据库的密码 -->
<property name="password" value="a"/>
<!-- 指定连接数据库连接池的最大连接数 -->
<property name="maxPoolSize" value="20"/>
<!-- 指定连接数据库连接池的最小连接数 -->
<property name="minPoolSize" value="1"/>
<!-- 指定连接数据库连接池的初始化连接数 -->
<property name="initialPoolSize" value="1"/>
<!-- 指定连接数据库连接池的连接的最大空闲时间 -->
<property name="maxIdleTime" value="20"/>
</bean>
<!--定义了Hibernate的SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>/hibernate-map-xml/AripBaseinfoOrg.hbm.xml</value>
<value>/hibernate-map-xml/Tlorrybaseinfo.hbm.xml</value>
<value>/hibernate-map-xml/Tlorrypp.hbm.xml</value>
<value>/hibernate-map-xml/Tlorrysjinfo.hbm.xml</value>
<value>/hibernate-map-xml/Tlorrystate.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<!-- 事务拦截器bean需要依赖注入一个事务管理器 -->
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributes">
<!-- 下面定义事务传播属性-->
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- ****************************************************************************************************************************** -->
<!-- 定义连接 GPS 服务器数据库 -->
<bean id="dataSourceGPS" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="jdbcUrl" value="jdbc:microsoft:sqlserver://111.225.0.21:1433"/>
<property name="user" value="wt"/>
<property name="password" value="w13"/>
<property name="maxPoolSize" value="20"/>
<property name="minPoolSize" value="1"/>
<property name="initialPoolSize" value="1"/>
<property name="maxIdleTime" value="20"/>
</bean>
<!--定义了Hibernate的SessionFactoryGPS -->
<bean id="sessionFactoryGPS" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSourceGPS"/>
<property name="mappingResources">
<list>
<value>/hibernate-map-xml/CarGjall.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
</props>
</property>
</bean>
<bean id="transactionManagerGPS" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactoryGPS"/>
</bean>
<bean id="transactionInterceptorGPS" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<!-- 事务拦截器bean需要依赖注入一个事务管理器 -->
<property name="transactionManager" ref="transactionManagerGPS"/>
<property name="transactionAttributes">
<!-- 下面定义事务传播属性-->
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!--车辆管理 ****************************************************************************************************************************** -->
<!-- 定义了 DAO dtbi dao tlorrybaseinfo imp -->
<bean id="dtbi" class="cn.arip.vm.dao.imp.imp_tlorrybaseinfo">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 定义了 DAO b_istate 通过id获取状态 ,比如: 机构代码 车辆品牌代码 车辆使用状态 代码 -->
<bean id="b_istate" class="cn.arip.vm.dao.imp.imp_tlorrystate">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- 定义 公共 分页 程序 ********************************************************************************************************* -->
<bean id="pagerService" class="cn.arip.page.PagerService"/>
<!-- GPS管理 ********************************************************************************************************* -->
<bean id="dgps" class="cn.arip.gps.dao.imp.imp_gps">
<property name="sessionFactory" ref="sessionFactoryGPS" />
</bean>
<!-- 司机管理 -->
<bean id="dtsi" class="cn.arip.driver.dao.imp.imp_driver">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>
----------------------------------------------------------------------
----------------------------------------------------------------------
[u][b]经上面说明,我测试成功了[/b][/u]
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config/>
<context:component-scan base-package="com.eriching"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClass}"/>
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"/>
<property name="user" value="${jdbc.user}"/>
<property name="password" value="${jdbc.password}"/>
<property name="maxPoolSize" value="40" />
<property name="minPoolSize" value="1" />
<property name="initialPoolSize" value="1" />
<!--最大空闲时间,25000秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime" value="600" />
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement" value="5" />
<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
<property name="acquireRetryAttempts" value="30" />
<!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
<property name="acquireRetryDelay" value="1000" />
<!--连接关闭时默认将所有未提交的操作回滚。Default: false -->
<property name="autoCommitOnClose" value="false" />
<!-- 获取connnection时测试是否有效 -->
<property name="testConnectionOnCheckin" value="true" />
<!--每18000秒检查所有连接池中的空闲连接 -->
<property name="idleConnectionTestPeriod" value="60" />
<!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出
SQLException,如设为0则无限期等待。单位毫秒。Default: 0 -->
<property name="checkoutTimeout" value="3000" />
</bean>
<!--定义了Hibernate的SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- annotation -->
<!-- packagesToScan -->
<property name="packagesToScan">
<list>
<value>com.gxh.**.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="current_session_context_class">thread</prop>
<prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.use_outer_join">true</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.jdbc.batch_size">50</prop>
<prop key="hibernate.jdbc.fetch_size">50</prop>
<prop key="hibernate.generate_statistics">true</prop>
<!-- 二级缓存EHCache start -->
<prop key="hibernate.cache.user_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<!-- 查询缓存 -->
<prop key="hibernate.cache.use_query_cache">false</prop>
<!-- 二级缓存EHCache end-->
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.connection.characterEncoding">GBK</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
</props>
</property>
</bean>
<!-- 配置事务管理器 -->
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="dataSource2" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClass2}"/>
<property name="jdbcUrl" value="${jdbc.jdbcUrl2}"/>
<property name="user" value="${jdbc.user2}"/>
<property name="password" value="${jdbc.password2}"/>
<property name="maxPoolSize" value="40" />
<property name="minPoolSize" value="1" />
<property name="initialPoolSize" value="1" />
<!--最大空闲时间,25000秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime" value="25000" />
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement" value="10" />
<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
<property name="acquireRetryAttempts" value="30" />
<!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
<property name="acquireRetryDelay" value="1000" />
<!--连接关闭时默认将所有未提交的操作回滚。Default: false -->
<property name="autoCommitOnClose" value="false" />
<!-- 获取connnection时测试是否有效 -->
<property name="testConnectionOnCheckin" value="true" />
<!--每18000秒检查所有连接池中的空闲连接 -->
<property name="idleConnectionTestPeriod" value="60" />
<!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出
SQLException,如设为0则无限期等待。单位毫秒。Default: 0 -->
<property name="checkoutTimeout" value="3000" />
</bean>
<!--定义了Hibernate的SessionFactory -->
<bean id="sessionFactory2"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource2" />
<!-- annotation -->
<!-- packagesToScan -->
<property name="packagesToScan">
<list>
<value>com.gxh.**.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="current_session_context_class">thread</prop>
<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.use_outer_join">true</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.jdbc.batch_size">50</prop>
<prop key="hibernate.jdbc.fetch_size">50</prop>
<prop key="hibernate.generate_statistics">true</prop>
<!-- 二级缓存EHCache start -->
<prop key="hibernate.cache.user_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<!-- 查询缓存 -->
<prop key="hibernate.cache.use_query_cache">false</prop>
<!-- 二级缓存EHCache end-->
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.connection.characterEncoding">GBK</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
</props>
</property>
</bean>
<!-- 配置事务管理器 -->
<tx:annotation-driven transaction-manager="txManager2"/>
<bean id="txManager2" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory2"/>
</bean>
</beans>