<?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>