首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

hibernate跟springde 的一段配置文件

2012-06-29 
hibernate和springde 的一段配置文件?xml version1.0 encodingUTF-8?beans xmlnshttp://www.sp

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>

热点排行