08-07
23
添加数据库缓冲区
作者:Java伴侣 日期:2008-07-23
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>root</value>
</property>
</bean>
<bean id="localSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<list>
<value>com/xiang/model/Dept.hbm.xml</value>
<value>com/xiang/model/User.hbm.xml</value>
<value>com/xiang/model/Role.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<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.max_fetch_depth">1</prop>
<!--<prop key="hibernate.hbm2ddl.auto">update</prop>-->
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider
</prop>
</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean
class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
</entry>
</map>
</property>
</bean>
<bean id="hibernateAccessor"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="localSessionFactory" />
</bean>
<bean id="sessionFactory" factory-bean="hibernateAccessor"
factory-method="getSessionFactory" />
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>root</value>
</property>
</bean>
<bean id="localSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<list>
<value>com/xiang/model/Dept.hbm.xml</value>
<value>com/xiang/model/User.hbm.xml</value>
<value>com/xiang/model/Role.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<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.max_fetch_depth">1</prop>
<!--<prop key="hibernate.hbm2ddl.auto">update</prop>-->
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider
</prop>
</props>
</property>
<property name="eventListeners">
<map>
<entry key="merge">
<bean
class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
</entry>
</map>
</property>
</bean>
<bean id="hibernateAccessor"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="localSessionFactory" />
</bean>
<bean id="sessionFactory" factory-bean="hibernateAccessor"
factory-method="getSessionFactory" />
评论: 0 | 引用: 0 | 查看次数: 636
发表评论