Check open status before close call (aligned with EntityManagerFactoryUtils)
Closes gh-27972
This commit is contained in:
parent
652c13a6ea
commit
0a92d84778
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -133,8 +133,10 @@ public abstract class SessionFactoryUtils {
|
|||
public static void closeSession(@Nullable Session session) {
|
||||
if (session != null) {
|
||||
try {
|
||||
if (session.isOpen()) {
|
||||
session.close();
|
||||
}
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
logger.error("Failed to release Hibernate Session", ex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue