Bonjour
Je cherche actuellement à comprendre comment sont fait les commit de mes requetes dans un site réalisé avec Spring...
En fait, j'ai trouvé ça dans spring-transactions.xml :
de même, dans spring-database.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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- ################################################################ Ce fichier décrit l'intercepteur AOP (voir spring-aop.xml) pour les transactions. ################################################################ --> <!-- Définit les méthodes auquelles vont être affectés des attributs transactionnels par leurs noms --> <bean id="daoTxAttributes" class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource"> <property name="properties"> <props> <prop key="find*">PROPAGATION_SUPPORTS</prop> <prop key="list*">PROPAGATION_SUPPORTS</prop> <prop key="count*">PROPAGATION_SUPPORTS</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="create*">PROPAGATION_REQUIRED</prop> <prop key="createAndGet*">PROPAGATION_REQUIRED,ISOLATION_SERIALIZABLE</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- Définit l'intercepteur qui lors de la création des beans, va affecter les attributs et faire la liaison avec le transactionManager--> <bean id="methodNamesTxInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager"><ref bean="transactionManager"/></property> <property name="transactionAttributeSource"><ref bean="daoTxAttributes"/></property> </bean> </beans>
J'suis allé regarder du côté de org.apache.commons.dbcp.BasicDataSource mais rien ne me dit la stratégie appliquée par défaut, surtout que la propriété defaultAutoCommit est activée par défaut...
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- ################################################################ Ce fichier décrit les Beans Liés à l'accès aux bases de données. Certains paramètres sont externalisés pour faciliter leur modification à l'installation, dans le fichier database-access.properties présent dans le classpath ################################################################ --> <!-- création de la datasource --> <bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"><value>${jdbc.driverClassName}</value></property> <property name="url"><value>${jdbc.url}</value></property> <property name="username"><value>${jdbc.username}</value></property> <property name="password"><value>${jdbc.password}</value></property> <!--property name="defaultAutoCommit"><value>false</value></property--> </bean> <!-- Transaction manager pour une simple DataSource JDBC --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource"><ref local="datasource"/></property> </bean> </beans>
Des pistes ?
Merci d'avance !
ZedroS
Partager