Bonjour tt le monde,

je suis en train de lutter pour mettre spring en place dans mon environnement (hibernate3). J'ai un problème au niveau de la gestion des transaction. Je ne vois pas trop comment prendre la chose. En fait, je ne sais pas trop comment faire simplement ce que je dois faire.

J'aimerais limiter les transactions à la durée de vie d'une requête, d'une manière générale, sans avoir à me préoccuper des méthodes qui sont invoquées. En gros:

1. Requête
2. Ouverture session hibernate
3. Démarrage transaction
4. Exécution code divers
5. Commit transaction si pas d'exception, rollback sinon
6. Fermeture session hibernate

Extrait de mon applicationContext.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
<bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="configLocation">
            <value>classpath:hibernate.cfg.xml</value>
        </property>
        <property name="dataSource">
            <ref bean="myDataSource" />
        </property>
    </bean>

    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>


    <!-- Transaction Interceptor -->
    <bean id="myTransactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
        <property name="transactionManager">
            <ref bean="transactionManager" />
        </property>
        <!-- Certainement ici qu'il faut changer... mais quoi? -->
        <property name="transactionAttributeSource">
             <value>services.IOrderService.*=PROPAGATION_REQUIRED</value> 
        </property>
    </bean>
Quelqu'un pourrait m'orienter?

Merci