9
I have started to use Guice method-level transactions like described here. I have a message like
@Inject
private EntityManager entityManager;
@Transactional
public UserSession createSession(User user, String browser) {
UserSession session = new UserSession(user, browser);
entityManager.persist(session);
}
From the short description i thought wis should be enough. But i get an error cause no transaction is started. It works only if i start and commit it by myself.
The Object is created by Guice on the Start of my Application in an initializer. the same Instance is used for each request.
Why is it not working?