日期:2014-05-20 浏览次数:20662 次
<!-- 配置DataSource --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <!--配置hibernate --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> <property name="packagesToScan"> <list> <value>com.model</value> </list> </property> </bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect </prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">false</prop> <prop key="hibernate.cglib.use_reflection_optimizer">true</prop> <prop key="connection.provider_class">org.hibernate.connection.ProxoolConnectionProvider </prop> <prop key="hibernate.proxool.xml">../proxool.xml</prop> <prop key="hibernate.proxool.pool_alias">cocacola_sqlserver</prop> </props> </property> <property name="mappingLocations"> <value>classpath:/com/cocacola/domain/*.hbm.xml </value> </property> </bean>
<?xml version="1.0" encoding="UTF-8"?> <something-else-entirely> <proxool> <alias>cocacola_mysql</alias> <driver-url>jdbc:mysql://localhost:3306/cocacola</driver-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <driver-properties> <property name="user" value="root" /> <property name="password" value="d" /> </driver-properties> <maximum-connection-count>100</maximum-connection-count> <minimum-connection-count>10</minimum-connection-count> <simultaneous-build-throttle>30</simultaneous-build-throttle> <prototype-count>3</prototype-count> <house-keeping-test-sql>select 1 from dual</house-keeping-test-sql> </proxool> <proxool> <alias>cocacola_sqlserver</alias> <driver-url>jdbc:sqlserver://localhost:1433;databasename=cocacola</driver-url> <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class> <driver-properties> <property name="user" value="sa" /> <property name="password" value="" /> </driver-properties> <maximum-connection-count>100</maximum-connection-count> <minimum-connection-count>10</minimum-connection-count> <simultaneous-build-throttle>30</simultaneous-build-throttle> <prototype-count>3</prototype-count> <house-keeping-test-sql>select 1</house-keeping-test-sql> </proxool> </something-else-entirely>