Skip to content

Instantly share code, notes, and snippets.

View tsegismont's full-sized avatar

Thomas Segismont tsegismont

View GitHub Profile
@tsegismont
tsegismont / gist:2960922
Created June 20, 2012 16:56
Spring XML tx advice
<tx:advice id="defaultServiceMethodTxAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" propagation="SUPPORTS" read-only="true" />
<tx:method name="is*" propagation="SUPPORTS" read-only="true" />
<tx:method name="find*" propagation="SUPPORTS" read-only="true" />
<tx:method name="load*" propagation="SUPPORTS" read-only="true" />
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
@tsegismont
tsegismont / gist:2960038
Created June 20, 2012 14:01
Default Transaction Interception for spring @service objects
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="myDS" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<aop:config>
<aop:pointcut id="defaultServiceMethodTxPointcut"
expression="execution(!@org.springframework.transaction.annotation.Transactional * *(..))