봄 트 랜 잭 션 설정

5053 단어 봄 사무
Spring 에서 의 사무 설정 을 정리 합 니 다.
   
<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="dateSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
		<property name="driverClassName">
			<value>oracle.jdbc.driver.OracleDriver</value>
		</property>
		<property name="url">
		<!--  jdbc:microsoft:sqlserver://127.0.0.1:1433  -->
			<value>jdbc:oracle:thin:@192.168.133.207:1521:oracle</value>
		</property>
		<property name="username">
			<value>oracle</value>
		</property>
		<property name="password">
			<value>oracle</value>
		</property>

	</bean>

	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref local="dateSource" />
		</property>
		<property name="mappingResources">
			<list>
				<value>com/zjsoft/bean/SystemUser.hbm.xml</value>
			</list>
		</property>

		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>

			<!-- 	<prop key="hibernate.show_sql">true</prop>   -->
				
				<prop key="hibernate.format_sql">true</prop>
			</props>
		</property>
	</bean>


	<!--    -->
   <!--
	<bean id="transactionManager"  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref local="sessionFactory"/>
        </property>
    </bean>
  txProxyTemplate         ,
    	        Bean         ,
    	      Spring         
    -->
		<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>

	<bean id="txProxyTemplate" abstract="true"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager" ref="transactionManager" />
		<property name="transactionAttributes">
			<props>
				<prop key="save*">PROPAGATION_REQUIRED</prop>
				<prop key="update*">PROPAGATION_REQUIRED</prop>
				<prop key="delete*">PROPAGATION_REQUIRED</prop>
				<prop key="remove*">PROPAGATION_REQUIRED</prop>
				<prop key="cancel*">PROPAGATION_REQUIRED</prop>
				<prop key="create*">PROPAGATION_REQUIRED</prop>
				<prop key="list*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="search*">PROPAGATION_REQUIRED,readOnly</prop>
				<!--  <prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>  -->
				<prop key="login">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>

      <bean id="systemUserDAO" class="com.zjsoft.dao.impl.SystemUserDAOImpl" scope="singleton">
	  <property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>

   <bean id="systemUserServiceTarget" class="com.zjsoft.service.impl.SystemUserServiceImpl">
 		<property name="systemUserDAO" ref="systemUserDAO"></property>
    </bean>
	<bean id="systemUserService" parent="txProxyTemplate" scope="singleton">
		<property name="target" ref="systemUserServiceTarget" />
	</bean>

</beans>

좋은 웹페이지 즐겨찾기