Polish contribution

See gh-31531
This commit is contained in:
Sam Brannen
2023-12-04 16:42:06 +01:00
parent 490b5c77fc
commit d71853f105
18 changed files with 55 additions and 51 deletions

View File

@@ -1151,15 +1151,15 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean
// Invocation on Session interface coming in...
return switch (method.getName()) {
// Only consider equal when proxies are identical.
case "equals" -> (proxy == args[0]);
// Only consider equal when proxies are identical.
// Use hashCode of Session proxy.
case "hashCode" -> System.identityHashCode(proxy);
// Use hashCode of Session proxy.
// Handle close method: suppress, not valid.
case "close" -> null;
// Handle close method: suppress, not valid.
default -> {
// Invoke method on target Session.
try {
// Invoke method on target Session.
Object retVal = method.invoke(this.target, args);
// If return value is a Query or Criteria, apply transaction timeout.

View File

@@ -413,17 +413,17 @@ public class LocalSessionFactoryBuilder extends Configuration {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return switch (method.getName()) {
// Only consider equal when proxies are identical.
case "equals" -> (proxy == args[0]);
// Only consider equal when proxies are identical.
// Use hashCode of EntityManagerFactory proxy.
case "hashCode" -> System.identityHashCode(proxy);
// Use hashCode of EntityManagerFactory proxy.
case "getProperties" -> getProperties();
// Call coming in through InfrastructureProxy interface...
case "getWrappedObject" -> getSessionFactory();
// Call coming in through InfrastructureProxy interface...
default -> {
// Regular delegation to the target SessionFactory,
// enforcing its full initialization...
try {
// Regular delegation to the target SessionFactory,
// enforcing its full initialization...
yield method.invoke(getSessionFactory(), args);
}
catch (InvocationTargetException ex) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 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.

View File

@@ -264,7 +264,7 @@ public abstract class SharedEntityManagerCreator {
case "getTransaction" -> {
throw new IllegalStateException(
"Not allowed to create transaction on shared EntityManager - " +
"use Spring transactions or EJB CMT instead");
"use Spring transactions or EJB CMT instead");
}
}