How to prevent reuse of EntityManager with guice-persist and @Transactional?
问题 According to this question, when using guice-persist , EntityManager is transaction-scoped. If I understand correctly, this means that a new EntityManager will be created for every transaction. When using guice-persist , it is suggested to use JpaPersistModule , which provides all the bindings, and simply inject Provider<EntityManager> into some class, like this: public class ProjectDAO { private final Provider<EntityManager> entityManagerProvider; @Inject public ProjectDAO(Provider