Polishing

This commit is contained in:
Juergen Hoeller 2020-05-26 23:35:38 +02:00
parent 1dea55dc20
commit 27d5fdc5aa
9 changed files with 20 additions and 24 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -97,7 +97,7 @@ public final class CachedIntrospectionResults {
SpringProperties.getFlag(IGNORE_BEANINFO_PROPERTY_NAME);
/** Stores the BeanInfoFactory instances. */
private static List<BeanInfoFactory> beanInfoFactories = SpringFactoriesLoader.loadFactories(
private static final List<BeanInfoFactory> beanInfoFactories = SpringFactoriesLoader.loadFactories(
BeanInfoFactory.class, CachedIntrospectionResults.class.getClassLoader());
private static final Log logger = LogFactory.getLog(CachedIntrospectionResults.class);

View File

@ -141,7 +141,6 @@ public abstract class ClassUtils {
primitiveTypes.addAll(primitiveWrapperTypeMap.values());
Collections.addAll(primitiveTypes, boolean[].class, byte[].class, char[].class,
double[].class, float[].class, int[].class, long[].class, short[].class);
primitiveTypes.add(void.class);
for (Class<?> primitiveType : primitiveTypes) {
primitiveTypeNameMap.put(primitiveType.getName(), primitiveType);
}

View File

@ -250,9 +250,6 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
return (txObject.hasConnectionHolder() && txObject.getConnectionHolder().isTransactionActive());
}
/**
* This implementation sets the isolation level but ignores the timeout.
*/
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) {
DataSourceTransactionObject txObject = (DataSourceTransactionObject) transaction;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
@ -58,10 +58,10 @@ import org.springframework.util.ClassUtils;
* 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.0/5.1 as well as 5.2/5.3, as of Spring 5.1.
* Set up with Hibernate 5.3, {@code LocalSessionFactoryBean} is an immediate alternative
* <p>Compatible with Hibernate 5.0/5.1 as well as 5.2/5.3/5.4, as of Spring 5.2.
* Set up with Hibernate 5.2+, {@code LocalSessionFactoryBean} is an immediate alternative
* to {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} for common
* JPA purposes: In particular with Hibernate 5.3, the Hibernate {@code SessionFactory}
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
@ -76,12 +76,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.0/5.1 as well as 5.2/5.3, as of Spring 5.1.
* Set up with Hibernate 5.2/5.3, this builder is also a convenient way to set up
* <p>Compatible with Hibernate 5.0/5.1 as well as 5.2/5.3/5.4, as of Spring 5.2.
* Set up with Hibernate 5.2+, this builder is also 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 {@code BeanContainer} integration,
* <p>This builder supports Hibernate 5.3/5.4 {@code BeanContainer} integration,
* {@link MetadataSources} from custom {@link BootstrapServiceRegistryBuilder}
* setup, as well as other advanced Hibernate configuration options beyond the
* standard JPA bootstrap contract.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -63,7 +63,7 @@ import org.springframework.util.ConcurrentReferenceHashMap;
*
* 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, the Hibernate {@code SessionFactory}
* 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.
*

View File

@ -398,7 +398,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
EntityManager em = txObject.getEntityManagerHolder().getEntityManager();
// Delegate to JpaDialect for actual transaction begin.
final int timeoutToUse = determineTimeout(definition);
int timeoutToUse = determineTimeout(definition);
Object transactionData = getJpaDialect().beginTransaction(em,
new JpaTransactionDefinition(definition, timeoutToUse, txObject.isNewEntityManagerHolder()));
txObject.setTransactionData(transactionData);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -76,7 +76,7 @@ import org.springframework.util.ReflectionUtils;
/**
* {@link org.springframework.orm.jpa.JpaDialect} implementation for
* Hibernate EntityManager. Developed against Hibernate 5.1/5.2/5.3.
* Hibernate EntityManager. Developed against Hibernate 5.1/5.2/5.3/5.4.
*
* @author Juergen Hoeller
* @author Costin Leau

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
@ -42,7 +42,7 @@ import org.springframework.lang.Nullable;
/**
* {@link org.springframework.orm.jpa.JpaVendorAdapter} implementation for Hibernate
* EntityManager. Developed and tested against Hibernate 5.0, 5.1, 5.2 and 5.3;
* EntityManager. Developed and tested against Hibernate 5.0, 5.1, 5.2, 5.3, 5.4;
* backwards-compatible with Hibernate 4.3 at runtime on a best-effort basis.
*
* <p>Exposes Hibernate's persistence provider and EntityManager extension interface,
@ -92,7 +92,7 @@ public class HibernateJpaVendorAdapter extends AbstractJpaVendorAdapter {
* JDBC Connection.
* <p>See {@link HibernateJpaDialect#setPrepareConnection(boolean)} for details.
* This is just a convenience flag passed through to {@code HibernateJpaDialect}.
* <p>On Hibernate 5.1/5.2, this flag remains {@code true} by default like against
* <p>On Hibernate 5.1+, this flag remains {@code true} by default like against
* previous Hibernate versions. The vendor adapter manually enforces Hibernate's
* new connection handling mode {@code DELAYED_ACQUISITION_AND_HOLD} in that case
* unless a user-specified connection handling mode property indicates otherwise;
@ -155,9 +155,9 @@ public class HibernateJpaVendorAdapter extends AbstractJpaVendorAdapter {
}
if (connectionReleaseOnClose) {
// Hibernate 5.1/5.2: manually enforce connection release mode ON_CLOSE (the former default)
// Hibernate 5.1+: manually enforce connection release mode ON_CLOSE (the former default)
try {
// Try Hibernate 5.2
// Try Hibernate 5.2+
AvailableSettings.class.getField("CONNECTION_HANDLING");
jpaProperties.put("hibernate.connection.handling_mode", "DELAYED_ACQUISITION_AND_HOLD");
}