I'm writing a rather simple application that uses GWT, Hibernate and Google Guice (with GIN). What I wanted to do is to have transactions managed using external manager (like using @Transactional
in Spring), instead of using EntityManager#getTransaction
. I tried using @Transactional
, but it doesn't seem to work for me.
I have EntityManager already injected using Providers
, like this:
/* import stuff */
public class DbProvider implements Provider<EntityManager> {
public EntityManager get() {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("persdb");
return emf.createEntityManager();
}
}
It seems to work properly when managing the transactions manually. I wanted to have transactions managed automatically, also for making the automated test with DBUnit.
Does anyone know how to solve that?