Skip to content

Commit ac5dc69

Browse files
committed
Update/remove outdated JPA and Hibernate version references
Closes gh-27487
1 parent f32f04d commit ac5dc69

12 files changed

+34
-52
lines changed

spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBean.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -51,21 +51,20 @@
5151
import org.springframework.core.task.AsyncTaskExecutor;
5252
import org.springframework.core.type.filter.TypeFilter;
5353
import org.springframework.lang.Nullable;
54-
import org.springframework.util.ClassUtils;
5554

5655
/**
5756
* {@link FactoryBean} that creates a Hibernate {@link SessionFactory}. This is the usual
5857
* way to set up a shared Hibernate SessionFactory in a Spring application context; the
5958
* SessionFactory can then be passed to data access objects via dependency injection.
6059
*
61-
* <p>Compatible with Hibernate 5.2/5.3/5.4, as of Spring 5.3.
60+
* <p>Compatible with Hibernate 5.5/5.6, as of Spring 6.0.
6261
* This Hibernate-specific {@code LocalSessionFactoryBean} can be an immediate alternative
63-
* to {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} for common
64-
* JPA purposes: In particular with Hibernate 5.3/5.4, the Hibernate {@code SessionFactory}
65-
* will natively expose the JPA {@code EntityManagerFactory} interface as well, and
66-
* Hibernate {@code BeanContainer} integration will be registered out of the box.
67-
* In combination with {@link HibernateTransactionManager}, this naturally allows for
68-
* mixing JPA access code with native Hibernate access code within the same transaction.
62+
* to {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} for
63+
* common JPA purposes: The Hibernate {@code SessionFactory} will natively expose the JPA
64+
* {@code EntityManagerFactory} interface as well, and Hibernate {@code BeanContainer}
65+
* integration will be registered out of the box. In combination with
66+
* {@link HibernateTransactionManager}, this naturally allows for mixing JPA access code
67+
* with native Hibernate access code within the same transaction.
6968
*
7069
* @author Juergen Hoeller
7170
* @since 4.2
@@ -469,17 +468,14 @@ public ResourceLoader getResourceLoader() {
469468
/**
470469
* Accept the containing {@link BeanFactory}, registering corresponding Hibernate
471470
* {@link org.hibernate.resource.beans.container.spi.BeanContainer} integration for
472-
* it if possible. This requires a Spring {@link ConfigurableListableBeanFactory}
473-
* and Hibernate 5.3 or higher on the classpath.
471+
* it if possible. This requires a Spring {@link ConfigurableListableBeanFactory}.
474472
* @since 5.1
475473
* @see SpringBeanContainer
476474
* @see LocalSessionFactoryBuilder#setBeanContainer
477475
*/
478476
@Override
479477
public void setBeanFactory(BeanFactory beanFactory) {
480-
if (beanFactory instanceof ConfigurableListableBeanFactory &&
481-
ClassUtils.isPresent("org.hibernate.resource.beans.container.spi.BeanContainer",
482-
getClass().getClassLoader())) {
478+
if (beanFactory instanceof ConfigurableListableBeanFactory) {
483479
this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
484480
}
485481
}

spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -77,12 +77,12 @@
7777
* Typically combined with {@link HibernateTransactionManager} for declarative
7878
* transactions against the {@code SessionFactory} and its JDBC {@code DataSource}.
7979
*
80-
* <p>Compatible with Hibernate 5.2/5.3/5.4, as of Spring 5.3.
80+
* <p>Compatible with Hibernate 5.5/5.6, as of Spring 6.0.
8181
* This Hibernate-specific factory builder can also be a convenient way to set up
8282
* a JPA {@code EntityManagerFactory} since the Hibernate {@code SessionFactory}
8383
* natively exposes the JPA {@code EntityManagerFactory} interface as well now.
8484
*
85-
* <p>This builder supports Hibernate 5.3/5.4 {@code BeanContainer} integration,
85+
* <p>This builder supports Hibernate {@code BeanContainer} integration,
8686
* {@link MetadataSources} from custom {@link BootstrapServiceRegistryBuilder}
8787
* setup, as well as other advanced Hibernate configuration options beyond the
8888
* standard JPA bootstrap contract.
@@ -221,8 +221,7 @@ else if (jtaTransactionManager instanceof TransactionManager) {
221221
/**
222222
* Set a Hibernate {@link org.hibernate.resource.beans.container.spi.BeanContainer}
223223
* for the given Spring {@link ConfigurableListableBeanFactory}.
224-
* <p>Note: Bean container integration requires Hibernate 5.3 or higher.
225-
* It enables autowiring of Hibernate attribute converters and entity listeners.
224+
* <p>This enables autowiring of Hibernate attribute converters and entity listeners.
226225
* @since 5.1
227226
* @see SpringBeanContainer
228227
* @see AvailableSettings#BEAN_CONTAINER

spring-orm/src/main/java/org/springframework/orm/hibernate5/SpringBeanContainer.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -34,7 +34,7 @@
3434
import org.springframework.util.ConcurrentReferenceHashMap;
3535

3636
/**
37-
* Spring's implementation of Hibernate 5.3's {@link BeanContainer} SPI,
37+
* Spring's implementation of Hibernate's {@link BeanContainer} SPI,
3838
* delegating to a Spring {@link ConfigurableListableBeanFactory}.
3939
*
4040
* <p>Auto-configured by {@link LocalSessionFactoryBean#setBeanFactory},
@@ -62,10 +62,10 @@
6262
* </pre>
6363
*
6464
* Please note that Spring's {@link LocalSessionFactoryBean} is an immediate alternative
65-
* to {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} for common
66-
* JPA purposes: In particular with Hibernate 5.3/5.4, the Hibernate {@code SessionFactory}
67-
* will natively expose the JPA {@code EntityManagerFactory} interface as well, and
68-
* Hibernate {@code BeanContainer} integration will be registered out of the box.
65+
* to {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} for
66+
* common JPA purposes: The Hibernate {@code SessionFactory} will natively expose the JPA
67+
* {@code EntityManagerFactory} interface as well, and Hibernate {@code BeanContainer}
68+
* integration will be registered out of the box.
6969
*
7070
* @author Juergen Hoeller
7171
* @since 5.1

spring-orm/src/main/java/org/springframework/orm/jpa/DefaultJpaDialect.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -36,8 +36,6 @@
3636
* <p>Simply begins a standard JPA transaction in {@link #beginTransaction} and
3737
* performs standard exception translation through {@link EntityManagerFactoryUtils}.
3838
*
39-
* <p><b>NOTE: Spring's JPA support requires JPA 2.1 or higher, as of Spring 5.0.</b>
40-
*
4139
* @author Juergen Hoeller
4240
* @since 2.0
4341
* @see JpaTransactionManager#setJpaDialect

spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -333,7 +333,7 @@ private static void cleanupTransaction(@Nullable Object transactionData, EntityM
333333

334334
/**
335335
* Apply the current transaction timeout, if any, to the given JPA Query object.
336-
* <p>This method sets the JPA 2.0 query hint "jakarta.persistence.query.timeout" accordingly.
336+
* <p>This method sets the JPA query hint "jakarta.persistence.query.timeout" accordingly.
337337
* @param query the JPA Query object
338338
* @param emf the JPA EntityManagerFactory that the Query was created for
339339
*/

spring-orm/src/main/java/org/springframework/orm/jpa/JpaDialect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -28,7 +28,7 @@
2828
import org.springframework.transaction.TransactionException;
2929

3030
/**
31-
* SPI strategy that encapsulates certain functionality that standard JPA 2.1 does
31+
* SPI strategy that encapsulates certain functionality that standard JPA 3.0 does
3232
* not offer, such as access to the underlying JDBC Connection. This strategy is
3333
* mainly intended for standalone usage of a JPA provider; most of its functionality
3434
* is not relevant when running with JTA transactions.

spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -70,10 +70,6 @@
7070
* plus the {@link EntityManagerFactoryInfo} interface which exposes additional
7171
* metadata as assembled by this FactoryBean.
7272
*
73-
* <p><b>NOTE: Spring's JPA support requires JPA 2.1 or higher, as of Spring 5.0.</b>
74-
* JPA 1.0/2.0 based applications are still supported; however, a JPA 2.1 compliant
75-
* persistence provider is needed at runtime.
76-
*
7773
* @author Juergen Hoeller
7874
* @author Rod Johnson
7975
* @since 2.0

spring-orm/src/main/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBean.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -52,10 +52,6 @@
5252
* to the JPA provider, consider using Spring's more powerful
5353
* {@link LocalContainerEntityManagerFactoryBean} instead.
5454
*
55-
* <p><b>NOTE: Spring's JPA support requires JPA 2.1 or higher, as of Spring 5.0.</b>
56-
* JPA 1.0/2.0 based applications are still supported; however, a JPA 2.1 compliant
57-
* persistence provider is needed at runtime.
58-
*
5955
* @author Juergen Hoeller
6056
* @author Rod Johnson
6157
* @since 2.0

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -77,8 +77,6 @@
7777
* DataSource names are by default interpreted as JNDI names, and no load time weaving
7878
* is available (which requires weaving to be turned off in the persistence provider).
7979
*
80-
* <p><b>NOTE: Spring's JPA support requires JPA 2.1 or higher, as of Spring 5.0.</b>
81-
*
8280
* @author Juergen Hoeller
8381
* @author Stephane Nicoll
8482
* @since 2.0

spring-orm/src/main/java/org/springframework/orm/jpa/vendor/AbstractJpaVendorAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -88,7 +88,7 @@ protected String getDatabasePlatform() {
8888
* <p>Note that the exact semantics of this flag depend on the underlying
8989
* persistence provider. For any more advanced needs, specify the appropriate
9090
* vendor-specific settings as "jpaProperties".
91-
* <p><b>NOTE: Do not set this flag to 'true' while also setting JPA 2.1's
91+
* <p><b>NOTE: Do not set this flag to 'true' while also setting JPA's
9292
* {@code jakarta.persistence.schema-generation.database.action} property.</b>
9393
* These two schema generation mechanisms - standard JPA versus provider-native -
9494
* are mutually exclusive, e.g. with Hibernate 5.

spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -73,7 +73,7 @@
7373

7474
/**
7575
* {@link org.springframework.orm.jpa.JpaDialect} implementation for
76-
* Hibernate EntityManager. Developed against Hibernate 5.2/5.3/5.4.
76+
* Hibernate EntityManager.
7777
*
7878
* @author Juergen Hoeller
7979
* @author Costin Leau

spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -44,8 +44,7 @@
4444

4545
/**
4646
* {@link org.springframework.orm.jpa.JpaVendorAdapter} implementation for Hibernate
47-
* EntityManager. Developed and tested against Hibernate 5.3 and 5.4;
48-
* backwards-compatible with Hibernate 5.2 at runtime on a best-effort basis.
47+
* EntityManager.
4948
*
5049
* <p>Exposes Hibernate's persistence provider and Hibernate's Session as extended
5150
* EntityManager interface, and adapts {@link AbstractJpaVendorAdapter}'s common

0 commit comments

Comments
 (0)