pombreda / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 1 forks source link

guice-persist: @Transactional does not work with multiple Persistence Units #705

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When using multiple persistence units where you cannot make the @Transactional 
annotation work without a n elaborate workaround involving copying verbatim 
core source (JpaLocalTxnInterceptor) from guice-persist into your project and 
then doing some very special bindings in your module.

The thread at 
https://groups.google.com/forum/?fromgroups#!searchin/google-guice/@Transactiona
l$20guice-persist$20not/google-guice/kbXr4k0N2QE/W_6VAvo5Mn0J discusses the 
problem and workaround.

Reproduce by following the procedure described in 
http://code.google.com/p/google-guice/wiki/GuicePersistMultiModules, then 
applying the @Transaction annotation to a method that persists entities as 
described in http://code.google.com/p/google-guice/wiki/Transactions

The intereceptor will not be called and the entity will not be saved.

Original issue reported on code.google.com by michael....@gmail.com on 17 May 2012 at 12:31

GoogleCodeExporter commented 9 years ago
Is there any simple workaround?

Original comment by bogdan.f...@3pillarglobal.com on 14 Jun 2013 at 7:53

GoogleCodeExporter commented 9 years ago
The solution is to have one persistence unit per guice module.

Original comment by michael....@gmail.com on 14 Jun 2013 at 2:37

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 20 Dec 2013 at 2:17