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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<!-- ******************************************************************************************* -->
<!-- DEFINITION D'UN GESTIONNAIRE DE TRANSACTION POUR HIBERNATE -->
<!-- ****************************************************************************************** -->
<!-- sessionFactory -->
<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- Gestionnaire de transaction Hibernate -->
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<!-- ******************************************************************************************* -->
<!-- DEFINITION DES DAO -->
<!-- ****************************************************************************************** -->
<!-- Ensemble des différents DAO -->
<bean id="daoAccount" class="org.os.easyguard.daopojo.DAOAccount">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="daoApplication"
class="org.os.easyguard.daopojo.DAOApplication">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="daoGroup" class="org.os.easyguard.daopojo.DAOGroup">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="daoResource"
class="org.os.easyguard.daopojo.DAOResource">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="daoRole" class="org.os.easyguard.daopojo.DAORole">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<bean id="daoUser" class="org.os.easyguard.daopojo.DAOUser">
<property name="sessionFactory">
<ref bean="mySessionFactory" />
</property>
</bean>
<tx:advice id="txAdvice"
transaction-manager="txManager">
<!-- the transactional semantics... -->
<tx:attributes>
<!-- all methods starting with 'get' are read-only -->
<tx:method name="*"
propagation="REQUIRED"
rollback-for="oued.ressources.ServiceLayerException" />
</tx:attributes>
</tx:advice>
<!-- ******************************************************************************************* -->
<!-- GESTION TRANSACTIONNELLE POUR LE SERVICE org.os.easyguard.service.application.Application -->
<!-- ****************************************************************************************** -->
<!-- ensure that the above transactional advice runs for any execution
of an operation defined by the FooService interface -->
<aop:config>
<aop:pointcut id="applicationOperation" expression="execution(* org.os.easyguard.service.application.IApplication.*(...))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="applicationOperation"/>
</aop:config>
<bean id="application"
class="org.os.easyguard.service.application.ApplicationImpl">
<property name="daoApplication">
<ref bean="daoApplication" />
</property>
<property name="daoResource">
<ref bean="daoResource" />
</property>
</bean>
</beans> |
Partager