From 1e0a85368e27d13f5fb75d11fe2decb28d6595e8 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sun, 25 Jan 2026 10:38:24 +0100 Subject: [PATCH] Revise setPersistenceUnitName javadoc Closes gh-36205 (cherry picked from commit 22cf7958a56b330513cfb0f14840bb612c09191b) --- .../orm/jpa/AbstractEntityManagerFactoryBean.java | 10 +++++----- .../jpa/LocalContainerEntityManagerFactoryBean.java | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java index 5b2ad0240c4..b8d1e55b7dd 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/AbstractEntityManagerFactoryBean.java @@ -69,7 +69,7 @@ import org.springframework.util.CollectionUtils; * a Spring application context. * *

Encapsulates the common functionality between the different JPA bootstrap - * contracts (standalone as well as container). + * contracts: standalone as well as container. * *

Implements support for standard JPA configuration conventions as well as * Spring's customizable {@link JpaVendorAdapter} mechanism, and controls the @@ -178,10 +178,10 @@ public abstract class AbstractEntityManagerFactoryBean implements } /** - * Specify the name of the EntityManagerFactory configuration. - *

Default is none, indicating the default EntityManagerFactory - * configuration. The persistence provider will throw an exception if - * ambiguous EntityManager configurations are found. + * Specify the name of the persistence unit configuration to use. + *

Default is none, indicating the default persistence unit configuration. + * The persistence provider will throw an exception if ambiguous persistence + * unit configurations are found. * @see jakarta.persistence.Persistence#createEntityManagerFactory(String) */ public void setPersistenceUnitName(@Nullable String persistenceUnitName) { diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java index 13e8c68dcaf..06ad211443d 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java @@ -133,9 +133,10 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage } /** - * Uses the specified persistence unit name as the name of the default - * persistence unit, if applicable. - *

NOTE: Only applied if no external PersistenceUnitManager specified. + * Specify the name of the persistence unit configuration to use. + *

Uses the specified persistence unit name as the name of the + * default persistence unit, if applicable. Otherwise, it selects + * among the available persistence units. * @see DefaultPersistenceUnitManager#setDefaultPersistenceUnitName */ @Override