]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - server/org.argeo.slc.siteserver/bundles/org.argeo.slc.server.hibernate/META-INF/spring/transaction.xml
Improve server structure
[gpl/argeo-slc.git] / server / org.argeo.slc.siteserver / bundles / org.argeo.slc.server.hibernate / META-INF / spring / transaction.xml
diff --git a/server/org.argeo.slc.siteserver/bundles/org.argeo.slc.server.hibernate/META-INF/spring/transaction.xml b/server/org.argeo.slc.siteserver/bundles/org.argeo.slc.server.hibernate/META-INF/spring/transaction.xml
new file mode 100644 (file)
index 0000000..7e6d0ad
--- /dev/null
@@ -0,0 +1,64 @@
+<?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.5.xsd
+       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
+
+       <!-- Transaction -->
+       <bean id="transactionManager"
+               class="org.springframework.orm.hibernate3.HibernateTransactionManager"
+               lazy-init="false">
+               <property name="sessionFactory" ref="sessionFactory" />
+       </bean>
+
+       <!-- DAO transactions -->
+       <aop:config>
+               <aop:pointcut id="daoProcessMethods"
+                       expression="execution(* org.argeo.slc.dao.process.*.*(..))" />
+               <aop:advisor advice-ref="daoAdvice" pointcut-ref="daoProcessMethods" />
+       </aop:config>
+
+       <aop:config>
+               <aop:pointcut id="daoRuntimeMethods"
+                       expression="execution(* org.argeo.slc.dao.runtime.*.*(..))" />
+               <aop:advisor advice-ref="daoAdvice" pointcut-ref="daoRuntimeMethods" />
+       </aop:config>
+
+       <aop:config>
+               <aop:pointcut id="daoTestMethods"
+                       expression="execution(* org.argeo.slc.dao.test.*.*(..))" />
+               <aop:advisor advice-ref="daoAdvice" pointcut-ref="daoTestMethods" />
+       </aop:config>
+
+       <aop:config>
+               <aop:pointcut id="daoTestTreeMethods"
+                       expression="execution(* org.argeo.slc.dao.test.tree.*.*(..))" />
+               <aop:advisor advice-ref="daoAdvice" pointcut-ref="daoTestTreeMethods" />
+       </aop:config>
+
+       <tx:advice id="daoAdvice" transaction-manager="transactionManager">
+               <tx:attributes>
+                       <tx:method name="get*" propagation="REQUIRED" read-only="true" />
+                       <tx:method name="list*" propagation="REQUIRED" read-only="true" />
+                       <tx:method name="*" propagation="REQUIRED" />
+               </tx:attributes>
+       </tx:advice>
+<!-- 
+       <aop:config>
+               <aop:pointcut id="pointcut.services.allMethods"
+                       expression="execution(* org.argeo.slc.services.*.*.*(..))" />
+               <aop:advisor advice-ref="advice.allMethodsRequired"
+                       pointcut-ref="pointcut.services.allMethods" />
+       </aop:config>
+
+       <tx:advice id="advice.allMethodsRequired"
+               transaction-manager="transactionManager">
+               <tx:attributes>
+                       <tx:method name="*" propagation="REQUIRED" />
+               </tx:attributes>
+       </tx:advice>
+ -->
+</beans>
\ No newline at end of file