There problem was that the MissionController
class is managed by Jersey, and not by Guice, so it wasn't intercepted by the JpaLocalTxnInterceptor
I solved it by moving DB-related code to another class, like this:
class MissionController {
@Inject MissionDao dao;
....
}
public class MissionDao {
@Inject Provider<EntityManager> em;
@Transactional
public void save(SimpleMission mission) {
em.get().persist(mission);
}
...
}