日期:2014-05-17 浏览次数:20682 次
<?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: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"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"> </property> <property name="url" value="jdbc:mysql://localhost:3306/weibo?useUnicode=true&characterEncoding=UTF-8"> </property> <property name="username" value="root"></property> <property name="password" value="root"></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate.show_sql"> true </prop> <prop key="hibernate.format_sql"> true </prop> <prop key="hbm2dll.auto"> update </prop> <prop key="hibernate.c3p0.max_size"> 30 </prop> <prop key="hibernate.c3p0.min_size"> 5 </prop> <prop key="hibernate.c3p0.timeout"> 1800 </prop> <prop key="hibernate.c3p0.max_statements"> 50 </prop> <prop key="hibernate.c3p0.idle_test_period"> 3000 </prop> <prop key="hibernate.c3p0.acquire_increment"> 2 </prop> <prop key="hibernate.c3p0.validate"> true </prop> <!-- 开启2级缓存 --> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <!-- 开启2级缓存统计功能 --> <!-- <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.cache.use_structured_entries">true</prop> --> <!-- 使用查询缓存 --> <!-- <prop key="hibernate.cache.use_query_cache">true</prop> --> </props> </property> <property name="mappingResources"> <list> <value>com/weibo/model/User.hbm.xml</value> <value>com/weibo