Skip to content

Commit 4f1d9fd

Browse files
committed
Explicit documentation on MutablePersistenceUnitInfo's addManagedPackage
Issue: SPR-12821
1 parent 370e3a5 commit 4f1d9fd

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit/MutablePersistenceUnitInfo.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -154,6 +154,11 @@ public URL getPersistenceUnitRootUrl() {
154154
return this.persistenceUnitRootUrl;
155155
}
156156

157+
/**
158+
* Add a managed class name to the persistence provider's metadata.
159+
* @see javax.persistence.spi.PersistenceUnitInfo#getManagedClassNames()
160+
* @see #addManagedPackage
161+
*/
157162
public void addManagedClassName(String managedClassName) {
158163
this.managedClassNames.add(managedClassName);
159164
}
@@ -163,6 +168,15 @@ public List<String> getManagedClassNames() {
163168
return this.managedClassNames;
164169
}
165170

171+
/**
172+
* Add a managed package to the persistence provider's metadata.
173+
* <p>Note: This refers to annotated {{package-info.java}} files. It does
174+
* <i>not</i> trigger entity scanning in the specified package; this is
175+
* rather the job of {@link DefaultPersistenceUnitManager#setPackagesToScan}.
176+
* @since 4.1
177+
* @see SmartPersistenceUnitInfo#getManagedPackages()
178+
* @see #addManagedClassName
179+
*/
166180
public void addManagedPackage(String packageName) {
167181
this.managedPackages.add(packageName);
168182
}
@@ -262,7 +276,8 @@ public ClassLoader getNewTempClassLoader() {
262276

263277
@Override
264278
public String toString() {
265-
return "PersistenceUnitInfo: name '" + this.persistenceUnitName + "', root URL [" + this.persistenceUnitRootUrl + "]";
279+
return "PersistenceUnitInfo: name '" + this.persistenceUnitName +
280+
"', root URL [" + this.persistenceUnitRootUrl + "]";
266281
}
267282

268283
}

0 commit comments

Comments
 (0)