polishing

This commit is contained in:
Stephane Nicoll 2014-08-21 10:14:41 +02:00
parent 79c75df088
commit f5cf3cd56e
1 changed files with 2 additions and 1 deletions

View File

@ -374,12 +374,13 @@ public abstract class SharedEntityManagerCreator {
}
@Override
protected void finalize() {
protected void finalize() throws Throwable {
// Trigger explicit EntityManager.close() call on garbage collection,
// in particular for open/close statistics to be in sync. This is
// only relevant if the Query object has not been executed, e.g.
// when just used for the early validation of query definitions.
EntityManagerFactoryUtils.closeEntityManager(this.em);
super.finalize();
}
}