ssh整合主要配置
cofig.xml? 文件
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
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/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
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd ">
??????????
??????????
<!-- 数据库连接池 -->
?<bean id="dataSource" value="${jdbc.driverClass}" />
??<property name="jdbcUrl" value="${jdbc.url}" />
??<property name="user" value="${jdbc.user}" />
??<property name="password" value="${jdbc.password}" />
??<!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
??<property name="initialPoolSize" value="1" />
??<!--连接池中保留的最小连接数。-->
??<property name="minPoolSize" value="1" />
??<!--连接池中保留的最大连接数。Default: 15 -->
??<property name="maxPoolSize" value="300" />
??<!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
??<property name="maxIdleTime" value="60" />
??<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
??<property name="acquireIncrement" value="5" />
??<!--每60秒检查所有连接池中的空闲连接。Default: 0 -->
??<property name="idleConnectionTestPeriod" value="60" />
?</bean>
?<bean id="sessionFactory"
??ref="dataSource" />
??<!-- 引入映射文件.hbm.xml -->
??<property name="mappingResources">
???<list>
????<value>cn/shopping/domain/Customers.hbm.xml</value>
????<value>cn/shopping/domain/Employees.hbm.xml</value>
????<value>cn/shopping/domain/Goods.hbm.xml</value>
????<value>cn/shopping/domain/Message.hbm.xml</value>
????<value>cn/shopping/domain/Orderdetails.hbm.xml</value>
????<value>cn/shopping/domain/Orders.hbm.xml</value>
????<value>cn/shopping/domain/Payments.hbm.xml</value>
????<value>cn/shopping/domain/Types.hbm.xml</value>
????<value>cn/shopping/domain/Users.hbm.xml</value>
???</list>
??</property>
??<!-- hiberante属性的配置 -->
??<property name="hibernateProperties">
???<props>
????<prop key="hibernate.dialect">${hibernate.dialect}</prop>
????<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
????<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
????<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
???</props>
??</property>
?</bean>
?<!-- 分散配置信息 -->
?<bean id="propertyPlaceholderConfigurer"
??ref="dataSource" />
?? </bean>
?
?<!--启动spring注解功能-->
?<tx:annotation-driven transaction-manager="transactionManager" />
?
?
</beans>
?
jdbc.properties 资源文件
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
hibernate.format_sql=false
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.url=jdbc\:mysql\://localhost\:3306/btocshopping?useUnicode\=true&characterEncoding\=UTF-8
jdbc.user=root
jdbc.password=123
用到的jar包自己可以上网找