Skip to content

Commit ccffc1a

Browse files
authored
Merge pull request #6493 from slub/close_database_connection_correct_38x
[3.8] Close database connection correct
2 parents 82fdef9 + 3e631fd commit ccffc1a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Kitodo/src/main/java/org/kitodo/production/version/KitodoVersionListener.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import javax.servlet.ServletContextListener;
2222
import javax.servlet.annotation.WebListener;
2323

24+
import org.kitodo.data.database.persistence.HibernateUtil;
25+
2426
/**
2527
* Listener to set up Kitodo versioning information from Manifest on application
2628
* startup.
@@ -46,6 +48,8 @@ public void contextInitialized(ServletContextEvent sce) {
4648

4749
@Override
4850
public void contextDestroyed(ServletContextEvent sce) {
49-
// nothing is done here
51+
// close connection to database on shutdown.
52+
// must be adjusted on switching to JPA or another connection layer.
53+
HibernateUtil.getSession().getSessionFactory().close();
5054
}
5155
}

0 commit comments

Comments
 (0)