I am using appengine with Objectify to access my datasource. I use Spring for my business layer. In order to play with data I use the objectify-appengine-spring factory.
I would like to use annotation based local transactions. Do you know about an existing implementation which I could plug directly as a spring bean?
I'd really like to avoid the pain of implementing my own transaction provider with thread locals.
Check LushLife's ObjectifyTransactionManager
here or here.
Spring XML config needed (you can find it here or here):
<!-- ObjectifyManager -->
<bean id="objectifyManager" class="ex.objectify.spring.ObjectifyManager">
<property name="basePackage" value="gso.model" />
</bean>
<!-- ObjectifyFactoryBean -->
<bean id="objectifyFactory" class="ex.objectify.spring.ObjectifyFactoryBean">
<property name="manager" ref="objectifyManager" />
</bean>
<!-- Custom TransactionManager implementation -->
<bean id="transactionManager" class="ex.objectify.spring.ObjectifyTransactionManager">
<property name="manager" ref="objectifyManager" />
</bean>
<!-- Necesary to enable use of @Transactional in your services -->
<tx:annotation-driven />
Don't forget to annotate your transactional methods or classes with @Transactional.
Special thanks to author of this project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With