Raise log level for exceptions from EntityManager close call

Closes gh-24501
This commit is contained in:
Juergen Hoeller
2020-02-12 16:48:42 +01:00
parent 4c1d227776
commit d12619cf1f
4 changed files with 9 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -170,11 +170,8 @@ public abstract class SessionFactoryUtils {
try {
session.close();
}
catch (HibernateException ex) {
logger.debug("Could not close Hibernate Session", ex);
}
catch (Throwable ex) {
logger.debug("Unexpected exception on closing Hibernate Session", ex);
logger.error("Failed to release Hibernate Session", ex);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -427,11 +427,8 @@ public abstract class EntityManagerFactoryUtils {
em.close();
}
}
catch (PersistenceException ex) {
logger.debug("Could not close JPA EntityManager", ex);
}
catch (Throwable ex) {
logger.debug("Unexpected exception on closing JPA EntityManager", ex);
logger.error("Failed to release JPA EntityManager", ex);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -603,9 +603,9 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
getJpaDialect().releaseJdbcConnection(conHandle,
txObject.getEntityManagerHolder().getEntityManager());
}
catch (Exception ex) {
catch (Throwable ex) {
// Just log it, to keep a transaction-related exception.
logger.error("Could not close JDBC connection after transaction", ex);
logger.error("Failed to release JDBC connection after transaction", ex);
}
}
}