<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans>

<!-- 数据库连接信息 -->
<bean id="DataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@172.16.20.241:1521:dbsvr</value>
</property>
<property name="username">
<value>hl3000</value>
</property>
<property name="password">
<value>hldw3101</value>
</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.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>

<!-- C3P0连接池配置 -->
<prop key="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</prop>
<prop key="hibernate.c3p0.max_size">20</prop>
<prop key="hibernate.c3p0.min_size">5</prop>
<prop key="hibernate.c3p0.timeout">120</prop>
<prop key="hibernate.c3p0.max_statements">100</prop>
<prop key="hibernate.c3p0.idle_test_period">120</prop>
<prop key="hibernate.c3p0.acquire_increment">2</prop>
<prop key="myeclipse.connection.profile">hl3000</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/hl3000/DBLogic/POJO/PermUserAccount.hbm.xml</value>
</list>
</property>
</bean>

<!-- AOP DAO Intecepter -->
   <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
     <property name="sessionFactory">
       <ref bean="SessionFactory"/>
     </property>
   </bean>

<!-- 底层数据访问实现类 -->
<bean id="PermUserAccountDAO" class="com.hl3000.DBLogic.DAO.Impl.PermUserAccountDAO">
<property name="sessionFactory">
<ref bean="SessionFactory" />
</property>
</bean>

<!-- 模块数据访问类 -->
<bean id="SysmrgAccessTarget" class="com.hl3000.DBLogic.Impl.SysmrgAccess">
<property name="permUserAccountDAO">
<ref bean="PermUserAccountDAO" />
</property>
</bean>

<!-- 模块数据访问接口 -->
<bean id="SysmrgAccess" class="org.springframework.aop.framework.ProxyFactoryBean">
    <property name="proxyInterfaces">
      <value>com.hl3000.DBLogic.ISysmrgAccess</value>
    </property>
    <property name="interceptorNames">
      <list>
        <value>hibernateInterceptor</value>
        <value>SysmrgAccessTarget</value>
      </list>
    </property>
   </bean>

<!-- Action -->
<bean name="/sysMngTree" class="com.hl3000.struts.action.SysMngTreeAction" singleton="false">
<property name="sysmrgAccess">
<ref bean="SysmrgAccess" />
</property>
</bean>

<bean name="/sysMasterList" class="com.hl3000.struts.action.SysMasterListAction">
<property name="sysmrgAccess">
<ref bean="SysmrgAccess" />
</property>
</bean>

<bean name="/userInfo" class="com.hl3000.struts.action.UserInfoAction">
<property name="sysmrgAccess">
<ref bean="SysmrgAccess" />
</property>
</bean>
</beans>还有事务管理,具体不是很懂 
<bean id="studentManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">  
   <property name="transactionManager">  
     <ref bean="myTransactionManager"/>  
   </property>  
   <property name="target">  
     <ref bean="studentManagerTarget"/>  
   </property>  
   <property name="transactionAttributes">  
     <props>  
          <prop key="save*">PROPAGATION_REQUIRED</prop>  
          <prop key="remove*">PROPAGATION_REQUIRED</prop>  
          <prop key="update*">PROPAGATION_REQUIRED</prop>                   
          <prop key="create*">PROPAGATION_REQUIRED</prop>      
          <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>  
     </props>  
   </property>  
 </bean> -------------------------------
<prop key="save*">PROPAGATION_REQUIRED</prop> 
<prop key="remove*">PROPAGATION_REQUIRED</prop> 
<prop key="update*">PROPAGATION_REQUIRED</prop> 
<prop key="create*">PROPAGATION_REQUIRED</prop> 
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop> 
这两句如何理解呢?

解决方案 »

  1.   

    <prop key="save*">PROPAGATION_REQUIRED</prop> 在你注入的类中,如果方法是以save开头的,则执行PROPAGATION_REQUIRED事务处理,也就是说,比如你有方法叫做saveUser(),那么在操作中会执行事务。
      

  2.   

    PROPAGATION_REQUIRED 具体甚么意思呢? 还有其他的类型么?