Don't have time to look into your problem. But here is a general
observation. In context of
http://code.google.com/p/google-guice/wiki/GuicePersistMultiModules
If you have a DAO or any class for that matter that works on
persistenceUnitOne with @Transactional it MUST be bound in the private
module one. Example:
Module one = ...bind(UnitOneDao.class) ...expose(UnitOneDao.class)
Module two = ...bind(UnitTwoDao.class) ...expose(UnitTwoDao.class)
now Injector = createInjector(one,two)
UnitOneDao daoOne = injector.getInstance // @Transactional works
within the "private space" of persistenceUnitOne
UnitTwoDao daoTwo = injector.getInstance // @Transactional works
within the "private space" of persistenceUnitTwo
If your business logic never needs to write to both databases in the
same "transaction" then you have no problems. Just make sure you work
with private module space and expose the things.
If on the other hand you need to have ACID semantic on both databases
at the same time you need to go with JTA provider and custom
@Transactional.
You can expose the things as
Module one
= ...bind(UnitOneDao.class) ...expose(UnitOneDao.class) ...expose(EntityManager.class).annotatedWith(DatabaseOne.class);
then you can @Inject @DatabaseOne EntityManager
Cheers
Alen
On Mar 10, 7:37 am, "Vicente J. Ruiz Jurado" <
vruiz.jur...@gmail.com>
wrote: