Update/remove outdated JPA and Hibernate version references

Closes gh-27487
This commit is contained in:
Juergen Hoeller 2021-09-28 19:10:09 +02:00
parent f32f04d841
commit ac5dc698e2
12 changed files with 34 additions and 52 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -51,21 +51,20 @@ import org.springframework.core.io.support.ResourcePatternUtils;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.core.type.filter.TypeFilter;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
/**
* {@link FactoryBean} that creates a Hibernate {@link SessionFactory}. This is the usual
* way to set up a shared Hibernate SessionFactory in a Spring application context; the
* SessionFactory can then be passed to data access objects via dependency injection.
*
* <p>Compatible with Hibernate 5.2/5.3/5.4, as of Spring 5.3.
* <p>Compatible with Hibernate 5.5/5.6, as of Spring 6.0.
* This Hibernate-specific {@code LocalSessionFactoryBean} can be an immediate alternative
* to {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} for common
* JPA purposes: In particular with Hibernate 5.3/5.4, the Hibernate {@code SessionFactory}
* will natively expose the JPA {@code EntityManagerFactory} interface as well, and
* Hibernate {@code BeanContainer} integration will be registered out of the box.
* In combination with {@link HibernateTransactionManager}, this naturally allows for
* mixing JPA access code with native Hibernate access code within the same transaction.
* to {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} for
* common JPA purposes: The Hibernate {@code SessionFactory} will natively expose the JPA
* {@code EntityManagerFactory} interface as well, and Hibernate {@code BeanContainer}
* integration will be registered out of the box. In combination with
* {@link HibernateTransactionManager}, this naturally allows for mixing JPA access code
* with native Hibernate access code within the same transaction.
*
* @author Juergen Hoeller
* @since 4.2
@ -469,17 +468,14 @@ public class LocalSessionFactoryBean extends HibernateExceptionTranslator
/**
* Accept the containing {@link BeanFactory}, registering corresponding Hibernate
* {@link org.hibernate.resource.beans.container.spi.BeanContainer} integration for
* it if possible. This requires a Spring {@link ConfigurableListableBeanFactory}
* and Hibernate 5.3 or higher on the classpath.
* it if possible. This requires a Spring {@link ConfigurableListableBeanFactory}.
* @since 5.1
* @see SpringBeanContainer
* @see LocalSessionFactoryBuilder#setBeanContainer
*/
@Override
public void setBeanFactory(BeanFactory beanFactory) {
if (beanFactory instanceof ConfigurableListableBeanFactory &&
ClassUtils.isPresent("org.hibernate.resource.beans.container.spi.BeanContainer",
getClass().getClassLoader())) {
if (beanFactory instanceof ConfigurableListableBeanFactory) {
this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -77,12 +77,12 @@ import org.springframework.util.ClassUtils;
* Typically combined with {@link HibernateTransactionManager} for declarative
* transactions against the {@code SessionFactory} and its JDBC {@code DataSource}.
*
* <p>Compatible with Hibernate 5.2/5.3/5.4, as of Spring 5.3.
* <p>Compatible with Hibernate 5.5/5.6, as of Spring 6.0.
* This Hibernate-specific factory builder can also be a convenient way to set up
* a JPA {@code EntityManagerFactory} since the Hibernate {@code SessionFactory}
* natively exposes the JPA {@code EntityManagerFactory} interface as well now.
*
* <p>This builder supports Hibernate 5.3/5.4 {@code BeanContainer} integration,
* <p>This builder supports Hibernate {@code BeanContainer} integration,
* {@link MetadataSources} from custom {@link BootstrapServiceRegistryBuilder}
* setup, as well as other advanced Hibernate configuration options beyond the
* standard JPA bootstrap contract.
@ -221,8 +221,7 @@ public class LocalSessionFactoryBuilder extends Configuration {
/**
* Set a Hibernate {@link org.hibernate.resource.beans.container.spi.BeanContainer}
* for the given Spring {@link ConfigurableListableBeanFactory}.
* <p>Note: Bean container integration requires Hibernate 5.3 or higher.
* It enables autowiring of Hibernate attribute converters and entity listeners.
* <p>This enables autowiring of Hibernate attribute converters and entity listeners.
* @since 5.1
* @see SpringBeanContainer
* @see AvailableSettings#BEAN_CONTAINER

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import org.springframework.util.Assert;
import org.springframework.util.ConcurrentReferenceHashMap;
/**
* Spring's implementation of Hibernate 5.3's {@link BeanContainer} SPI,
* Spring's implementation of Hibernate's {@link BeanContainer} SPI,
* delegating to a Spring {@link ConfigurableListableBeanFactory}.
*
* <p>Auto-configured by {@link LocalSessionFactoryBean#setBeanFactory},
@ -62,10 +62,10 @@ import org.springframework.util.ConcurrentReferenceHashMap;
* </pre>
*
* Please note that Spring's {@link LocalSessionFactoryBean} is an immediate alternative
* to {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} for common
* JPA purposes: In particular with Hibernate 5.3/5.4, the Hibernate {@code SessionFactory}
* will natively expose the JPA {@code EntityManagerFactory} interface as well, and
* Hibernate {@code BeanContainer} integration will be registered out of the box.
* to {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} for
* common JPA purposes: The Hibernate {@code SessionFactory} will natively expose the JPA
* {@code EntityManagerFactory} interface as well, and Hibernate {@code BeanContainer}
* integration will be registered out of the box.
*
* @author Juergen Hoeller
* @since 5.1

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -36,8 +36,6 @@ import org.springframework.transaction.TransactionException;
* <p>Simply begins a standard JPA transaction in {@link #beginTransaction} and
* performs standard exception translation through {@link EntityManagerFactoryUtils}.
*
* <p><b>NOTE: Spring's JPA support requires JPA 2.1 or higher, as of Spring 5.0.</b>
*
* @author Juergen Hoeller
* @since 2.0
* @see JpaTransactionManager#setJpaDialect

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -333,7 +333,7 @@ public abstract class EntityManagerFactoryUtils {
/**
* Apply the current transaction timeout, if any, to the given JPA Query object.
* <p>This method sets the JPA 2.0 query hint "jakarta.persistence.query.timeout" accordingly.
* <p>This method sets the JPA query hint "jakarta.persistence.query.timeout" accordingly.
* @param query the JPA Query object
* @param emf the JPA EntityManagerFactory that the Query was created for
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,7 +28,7 @@ import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionException;
/**
* SPI strategy that encapsulates certain functionality that standard JPA 2.1 does
* SPI strategy that encapsulates certain functionality that standard JPA 3.0 does
* not offer, such as access to the underlying JDBC Connection. This strategy is
* mainly intended for standalone usage of a JPA provider; most of its functionality
* is not relevant when running with JTA transactions.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -70,10 +70,6 @@ import org.springframework.util.ClassUtils;
* plus the {@link EntityManagerFactoryInfo} interface which exposes additional
* metadata as assembled by this FactoryBean.
*
* <p><b>NOTE: Spring's JPA support requires JPA 2.1 or higher, as of Spring 5.0.</b>
* JPA 1.0/2.0 based applications are still supported; however, a JPA 2.1 compliant
* persistence provider is needed at runtime.
*
* @author Juergen Hoeller
* @author Rod Johnson
* @since 2.0

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -52,10 +52,6 @@ import jakarta.persistence.spi.PersistenceProvider;
* to the JPA provider, consider using Spring's more powerful
* {@link LocalContainerEntityManagerFactoryBean} instead.
*
* <p><b>NOTE: Spring's JPA support requires JPA 2.1 or higher, as of Spring 5.0.</b>
* JPA 1.0/2.0 based applications are still supported; however, a JPA 2.1 compliant
* persistence provider is needed at runtime.
*
* @author Juergen Hoeller
* @author Rod Johnson
* @since 2.0

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -77,8 +77,6 @@ import org.springframework.util.ResourceUtils;
* DataSource names are by default interpreted as JNDI names, and no load time weaving
* is available (which requires weaving to be turned off in the persistence provider).
*
* <p><b>NOTE: Spring's JPA support requires JPA 2.1 or higher, as of Spring 5.0.</b>
*
* @author Juergen Hoeller
* @author Stephane Nicoll
* @since 2.0

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -88,7 +88,7 @@ public abstract class AbstractJpaVendorAdapter implements JpaVendorAdapter {
* <p>Note that the exact semantics of this flag depend on the underlying
* persistence provider. For any more advanced needs, specify the appropriate
* vendor-specific settings as "jpaProperties".
* <p><b>NOTE: Do not set this flag to 'true' while also setting JPA 2.1's
* <p><b>NOTE: Do not set this flag to 'true' while also setting JPA's
* {@code jakarta.persistence.schema-generation.database.action} property.</b>
* These two schema generation mechanisms - standard JPA versus provider-native -
* are mutually exclusive, e.g. with Hibernate 5.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -73,7 +73,7 @@ import org.springframework.transaction.support.ResourceTransactionDefinition;
/**
* {@link org.springframework.orm.jpa.JpaDialect} implementation for
* Hibernate EntityManager. Developed against Hibernate 5.2/5.3/5.4.
* Hibernate EntityManager.
*
* @author Juergen Hoeller
* @author Costin Leau

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -44,8 +44,7 @@ import org.springframework.lang.Nullable;
/**
* {@link org.springframework.orm.jpa.JpaVendorAdapter} implementation for Hibernate
* EntityManager. Developed and tested against Hibernate 5.3 and 5.4;
* backwards-compatible with Hibernate 5.2 at runtime on a best-effort basis.
* EntityManager.
*
* <p>Exposes Hibernate's persistence provider and Hibernate's Session as extended
* EntityManager interface, and adapts {@link AbstractJpaVendorAdapter}'s common