1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
<!--=========================== TRANSACTION ==================================-->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="transactionProxy" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!--=========================== DAO ==================================-->
<!-- Pour ne pas utiliser d interceptor, utilisez le bean faxDaoBean (classe FaxDaoImpl)-->
<!--Pour utiliser des interceptor , utilisez le bean faxDao( ci dessous) -->
<bean id="faxDaoBean" class="fax.dao.FaxDaoImpl" scope="prototype">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="faxDao" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces" value="fax.dao.IFaxDao"/>
<property name="interceptorNames">
<list>
<value>faxDaoInterceptor</value>
<value>faxDaoBean</value>
</list>
</property>
</bean>
<!--=========================== SESSSION FACTORY ==================================-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
scope="singleton">
<property name="configLocation" value="classpath:hibernate.cfg.xml"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.c3p0.autoCommitOnClose">true</prop>
<prop key="hibernate.autoCommitOnClose">true</prop>
<prop key="hibernate.autocommit">true</prop>
<prop key="hibernate.connection.release_mode">auto</prop>
<prop key="hibernate.transaction.auto_close_session">true</prop>
</props>
</property>
</bean> |
Partager