2323
2424import javax .sql .DataSource ;
2525
26+ import jakarta .persistence .PersistenceUnitTransactionType ;
2627import jakarta .persistence .SharedCacheMode ;
2728import jakarta .persistence .ValidationMode ;
28- import jakarta .persistence .spi .ClassTransformer ;
29- import jakarta .persistence .spi .PersistenceUnitTransactionType ;
3029import org .jspecify .annotations .Nullable ;
3130
3231import org .springframework .util .Assert ;
33- import org .springframework .util .ClassUtils ;
3432
3533/**
36- * Spring's base implementation of the JPA
34+ * Spring's mutable equivalent of the JPA
3735 * {@link jakarta.persistence.spi.PersistenceUnitInfo} interface,
3836 * used to bootstrap an {@code EntityManagerFactory} in a container.
3937 *
4038 * <p>This implementation is largely a JavaBean, offering mutators
4139 * for all standard {@code PersistenceUnitInfo} properties.
40+ * As of 7.0, it does <i>not</i> implement {@code PersistenceUnitInfo} but
41+ * rather serves as the state behind a runtime {@code PersistenceUnitInfo}
42+ * (for achieving compatibility between JPA 3.2 and 4.0 and for preventing
43+ * late mutation attempts through {@code PersistenceUnitInfo} downcasts).
4244 *
4345 * @author Rod Johnson
4446 * @author Juergen Hoeller
4547 * @author Costin Leau
4648 * @since 2.0
4749 */
48- @ SuppressWarnings ("removal" )
49- public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
50+ public class MutablePersistenceUnitInfo {
5051
5152 private @ Nullable String persistenceUnitName ;
5253
@@ -89,7 +90,6 @@ public void setPersistenceUnitName(@Nullable String persistenceUnitName) {
8990 this .persistenceUnitName = persistenceUnitName ;
9091 }
9192
92- @ Override
9393 public @ Nullable String getPersistenceUnitName () {
9494 return this .persistenceUnitName ;
9595 }
@@ -98,7 +98,6 @@ public void setPersistenceProviderClassName(@Nullable String persistenceProvider
9898 this .persistenceProviderClassName = persistenceProviderClassName ;
9999 }
100100
101- @ Override
102101 public @ Nullable String getPersistenceProviderClassName () {
103102 return this .persistenceProviderClassName ;
104103 }
@@ -107,7 +106,6 @@ public void setScopeAnnotationName(@Nullable String scopeAnnotationName) {
107106 this .scopeAnnotationName = scopeAnnotationName ;
108107 }
109108
110- @ Override
111109 public @ Nullable String getScopeAnnotationName () {
112110 return this .scopeAnnotationName ;
113111 }
@@ -116,7 +114,6 @@ public void addQualifierAnnotationName(String qualifierAnnotationName) {
116114 this .qualifierAnnotationNames .add (qualifierAnnotationName );
117115 }
118116
119- @ Override
120117 public List <String > getQualifierAnnotationNames () {
121118 return this .qualifierAnnotationNames ;
122119 }
@@ -125,7 +122,6 @@ public void setTransactionType(PersistenceUnitTransactionType transactionType) {
125122 this .transactionType = transactionType ;
126123 }
127124
128- @ Override
129125 public PersistenceUnitTransactionType getTransactionType () {
130126 if (this .transactionType != null ) {
131127 return this .transactionType ;
@@ -140,7 +136,6 @@ public void setJtaDataSource(@Nullable DataSource jtaDataSource) {
140136 this .jtaDataSource = jtaDataSource ;
141137 }
142138
143- @ Override
144139 public @ Nullable DataSource getJtaDataSource () {
145140 return this .jtaDataSource ;
146141 }
@@ -149,7 +144,6 @@ public void setNonJtaDataSource(@Nullable DataSource nonJtaDataSource) {
149144 this .nonJtaDataSource = nonJtaDataSource ;
150145 }
151146
152- @ Override
153147 public @ Nullable DataSource getNonJtaDataSource () {
154148 return this .nonJtaDataSource ;
155149 }
@@ -158,7 +152,6 @@ public void addMappingFileName(String mappingFileName) {
158152 this .mappingFileNames .add (mappingFileName );
159153 }
160154
161- @ Override
162155 public List <String > getMappingFileNames () {
163156 return this .mappingFileNames ;
164157 }
@@ -167,7 +160,6 @@ public void addJarFileUrl(URL jarFileUrl) {
167160 this .jarFileUrls .add (jarFileUrl );
168161 }
169162
170- @ Override
171163 public List <URL > getJarFileUrls () {
172164 return this .jarFileUrls ;
173165 }
@@ -176,7 +168,6 @@ public void setPersistenceUnitRootUrl(@Nullable URL persistenceUnitRootUrl) {
176168 this .persistenceUnitRootUrl = persistenceUnitRootUrl ;
177169 }
178170
179- @ Override
180171 public @ Nullable URL getPersistenceUnitRootUrl () {
181172 return this .persistenceUnitRootUrl ;
182173 }
@@ -190,7 +181,6 @@ public void addManagedClassName(String managedClassName) {
190181 this .managedClassNames .add (managedClassName );
191182 }
192183
193- @ Override
194184 public List <String > getManagedClassNames () {
195185 return this .managedClassNames ;
196186 }
@@ -208,7 +198,6 @@ public void addManagedPackage(String packageName) {
208198 this .managedPackages .add (packageName );
209199 }
210200
211- @ Override
212201 public List <String > getManagedPackages () {
213202 return this .managedPackages ;
214203 }
@@ -217,7 +206,6 @@ public void setExcludeUnlistedClasses(boolean excludeUnlistedClasses) {
217206 this .excludeUnlistedClasses = excludeUnlistedClasses ;
218207 }
219208
220- @ Override
221209 public boolean excludeUnlistedClasses () {
222210 return this .excludeUnlistedClasses ;
223211 }
@@ -226,7 +214,6 @@ public void setSharedCacheMode(SharedCacheMode sharedCacheMode) {
226214 this .sharedCacheMode = sharedCacheMode ;
227215 }
228216
229- @ Override
230217 public SharedCacheMode getSharedCacheMode () {
231218 return this .sharedCacheMode ;
232219 }
@@ -235,7 +222,6 @@ public void setValidationMode(ValidationMode validationMode) {
235222 this .validationMode = validationMode ;
236223 }
237224
238- @ Override
239225 public ValidationMode getValidationMode () {
240226 return this .validationMode ;
241227 }
@@ -249,7 +235,6 @@ public void setProperties(Properties properties) {
249235 this .properties = properties ;
250236 }
251237
252- @ Override
253238 public Properties getProperties () {
254239 return this .properties ;
255240 }
@@ -258,12 +243,10 @@ public void setPersistenceXMLSchemaVersion(String persistenceXMLSchemaVersion) {
258243 this .persistenceXMLSchemaVersion = persistenceXMLSchemaVersion ;
259244 }
260245
261- @ Override
262246 public String getPersistenceXMLSchemaVersion () {
263247 return this .persistenceXMLSchemaVersion ;
264248 }
265249
266- @ Override
267250 public void setPersistenceProviderPackageName (@ Nullable String persistenceProviderPackageName ) {
268251 this .persistenceProviderPackageName = persistenceProviderPackageName ;
269252 }
@@ -273,32 +256,6 @@ public void setPersistenceProviderPackageName(@Nullable String persistenceProvid
273256 }
274257
275258
276- /**
277- * This implementation returns the default ClassLoader.
278- * @see org.springframework.util.ClassUtils#getDefaultClassLoader()
279- */
280- @ Override
281- public @ Nullable ClassLoader getClassLoader () {
282- return ClassUtils .getDefaultClassLoader ();
283- }
284-
285- /**
286- * This implementation throws an UnsupportedOperationException.
287- */
288- @ Override
289- public void addTransformer (ClassTransformer classTransformer ) {
290- throw new UnsupportedOperationException ("addTransformer not supported" );
291- }
292-
293- /**
294- * This implementation throws an UnsupportedOperationException.
295- */
296- @ Override
297- public ClassLoader getNewTempClassLoader () {
298- throw new UnsupportedOperationException ("getNewTempClassLoader not supported" );
299- }
300-
301-
302259 @ Override
303260 public String toString () {
304261 return "PersistenceUnitInfo: name '" + this .persistenceUnitName +
0 commit comments