mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Revise setPersistenceUnitName javadoc
Closes gh-36205
This commit is contained in:
+4
-4
@@ -171,10 +171,10 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the name of the EntityManagerFactory configuration.
|
||||
* <p>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.
|
||||
* <p>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) {
|
||||
|
||||
+4
-3
@@ -141,9 +141,10 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the specified persistence unit name as the name of the default
|
||||
* persistence unit, if applicable.
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* Specify the name of the persistence unit configuration to use.
|
||||
* <p>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
|
||||
|
||||
+13
-1
@@ -127,11 +127,23 @@ public class LocalEntityManagerFactoryBean extends AbstractEntityManagerFactoryB
|
||||
*/
|
||||
public PersistenceConfiguration getPersistenceConfiguration() {
|
||||
if (this.configuration == null) {
|
||||
this.configuration = new PersistenceConfiguration(getPersistenceUnitName());
|
||||
String name = getPersistenceUnitName();
|
||||
Assert.state(name != null, "No persistenceUnitName set");
|
||||
this.configuration = new PersistenceConfiguration(name);
|
||||
}
|
||||
return this.configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the name of the persistence unit configuration to use.
|
||||
* <p>Uses the specified persistence unit name as the name of the local
|
||||
* persistence unit built through {@link #getPersistenceConfiguration()}, if
|
||||
* applicable. Otherwise, it selects among the available persistence units.
|
||||
* <p>Note: This setter method is not meant to be used in combination with
|
||||
* {@link #setPersistenceConfiguration} which derives the persistence unit
|
||||
* name from the given {@link PersistenceConfiguration} instance instead.
|
||||
* @see #getPersistenceConfiguration()
|
||||
*/
|
||||
@Override
|
||||
public void setPersistenceUnitName(@Nullable String persistenceUnitName) {
|
||||
Assert.state(this.configuration == null || this.configuration.name().equals(persistenceUnitName),
|
||||
|
||||
Reference in New Issue
Block a user