google / google/guice

@Inject EntityManager outside @Transactional creates stale connections

Open
#1,053 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

[stackoverflow](http://stackoverflow.com) handles this issue in a three year old post, but the implementation is still the same;

[ Lifecycle management of EntityManager is kind of broken if it's injected via @Inject EntityManager](http://stackoverflow.com/questions/18101488/does-guice-persist-provide-transaction-scoped-or-application-managed-entitymanag). Check answer 7 and 16.

There should be a safety check for transaction-scoped semantics which prevents EntityManager instances outside @Transactional methods.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.