Add session rollback handling in Connection.java, improve resource management, and refine debug logging in LoginController.

This commit is contained in:
2025-08-05 23:46:47 +02:00
parent d73f057596
commit 56f4ccf40e
2 changed files with 13 additions and 2 deletions
@@ -97,10 +97,20 @@ public class Connection {
sqlSessionFactory = createSqlSessionFactory(settings, addMappers);
}
try (SqlSession session = sqlSessionFactory.openSession()) {
SqlSession session = null;
try {
session = sqlSessionFactory.openSession();
consumer.accept(session);
session.commit();
} catch (Exception e) {
if (session != null) {
session.rollback();
}
log.error("Failed to run query", e);
} finally {
if (session != null) {
session.close();
}
}
}).start();
}