读书人

hibernate跟springde 的一段配置文件

发布时间: 2012-06-29 15:48:47 作者: rapoo

hibernate和springde 的一段配置文件
<?xml version="1.0" encoding="UTF-8"?>
<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-2.0.xsd">



<!-- 定义了hibernate的sessionFactory -->
<bean id="sessionFactory"
ref="sessionFactory" />
<!-- 设置每页显示的记录数 -->
<property name="pageSize" value="3" />
</bean>

<!-- 配置Comment Dao组件 -->
<bean id="commentDao" ref="sessionFactory" />
<!-- 设置每页显示的记录数 -->
<property name="pageSize" value="3" />
</bean>

<!-- 配置Blog业务逻辑组件 -->
<bean id="blogManager"
ref="blogDao" />
<property name="commentDao" ref="commentDao" />
</bean>

<!-- 配置事务管理器 -->
<bean id="transactionManager"
ref="sessionFactory" />
</bean>

<!-- 配置事务拦截器 -->
<bean id="transactionInteceptor"
ref="transactionManager" />
<property name="transactionAttributes">
<!-- 下面定义事务传播属性 -->
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>

<!-- 定义BeanNameAutoProxyCreator -->
<bean
ref="blogManager" />
</bean>




</beans>

读书人网 >开源软件

热点推荐