Initial support for JPA 3.2
Includes proxy support for Query#getSingleResultOrNull() and EntityManagerFactory#getName() invocations. Closes gh-31157
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -709,6 +709,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
switch (method.getName()) {
|
||||
case "equals" -> {
|
||||
@@ -729,6 +730,10 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
case "getName" -> {
|
||||
// Handle JPA 3.2 getName method locally.
|
||||
return this.entityManagerFactoryBean.getPersistenceUnitName();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -85,6 +85,7 @@ public abstract class SharedEntityManagerCreator {
|
||||
"execute", // jakarta.persistence.StoredProcedureQuery.execute()
|
||||
"executeUpdate", // jakarta.persistence.Query.executeUpdate()
|
||||
"getSingleResult", // jakarta.persistence.Query.getSingleResult()
|
||||
"getSingleResultOrNull", // jakarta.persistence.Query.getSingleResultOrNull()
|
||||
"getResultStream", // jakarta.persistence.Query.getResultStream()
|
||||
"getResultList", // jakarta.persistence.Query.getResultList()
|
||||
"list", // org.hibernate.query.Query.list()
|
||||
|
||||
Reference in New Issue
Block a user