Polishing

This commit is contained in:
Juergen Hoeller
2018-07-04 15:46:52 +02:00
parent a1d35c23aa
commit 1ab9e2ceda
12 changed files with 53 additions and 45 deletions

View File

@@ -69,7 +69,7 @@ import org.springframework.util.ReflectionUtils;
*
* <p><b>NOTE: Hibernate access code can also be coded against the native Hibernate
* {@link Session}. Hence, for newly started projects, consider adopting the standard
* Hibernate style of coding against {@link SessionFactory#getCurrentSession()}.</b>
* Hibernate style of coding against {@link SessionFactory#getCurrentSession()}.
* Alternatively, use {@link #execute(HibernateCallback)} with Java 8 lambda code blocks
* against the callback-provided {@code Session} which results in elegant code as well,
* decoupled from the Hibernate Session lifecycle. The remaining operations on this

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -203,7 +203,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* @see org.springframework.jdbc.core.JdbcTemplate
*/
public void setDataSource(@Nullable DataSource dataSource) {
if (dataSource != null && dataSource instanceof TransactionAwareDataSourceProxy) {
if (dataSource instanceof TransactionAwareDataSourceProxy) {
// If we got a TransactionAwareDataSourceProxy, we need to perform transactions
// for its underlying target DataSource, else data access code won't see
// properly exposed transactions (i.e. transactions for the target DataSource).
@@ -336,7 +336,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
@Nullable
public Interceptor getEntityInterceptor() throws IllegalStateException, BeansException {
if (this.entityInterceptor instanceof Interceptor) {
return (Interceptor) entityInterceptor;
return (Interceptor) this.entityInterceptor;
}
else if (this.entityInterceptor instanceof String) {
if (this.beanFactory == null) {
@@ -777,7 +777,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* from the {@code org.springframework.dao} hierarchy.
* <p>Will automatically apply a specified SQLExceptionTranslator to a
* Hibernate JDBCException, else rely on Hibernate's default translation.
* @param ex HibernateException that occurred
* @param ex the HibernateException that occurred
* @return a corresponding DataAccessException
* @see SessionFactoryUtils#convertHibernateAccessException
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -25,9 +25,9 @@ import org.springframework.transaction.support.ResourceHolderSupport;
import org.springframework.util.Assert;
/**
* Session holder, wrapping a Hibernate Session and a Hibernate Transaction.
* HibernateTransactionManager binds instances of this class to the thread,
* for a given SessionFactory.
* Resource holder wrapping a Hibernate {@link Session} (plus an optional {@link Transaction}).
* {@link HibernateTransactionManager} binds instances of this class to the thread,
* for a given {@link org.hibernate.SessionFactory}.
*
* <p>Note: This is an SPI class, not intended to be used by applications.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 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.
@@ -32,9 +32,9 @@ import org.springframework.lang.Nullable;
import org.springframework.transaction.support.TransactionSynchronizationManager;
/**
* Implementation of Hibernate 3.1's CurrentSessionContext interface
* that delegates to Spring's SessionFactoryUtils for providing a
* Spring-managed current Session.
* Implementation of Hibernate 3.1's {@link CurrentSessionContext} interface
* that delegates to Spring's {@link SessionFactoryUtils} for providing a
* Spring-managed current {@link Session}.
*
* <p>This CurrentSessionContext implementation can also be specified in custom
* SessionFactory setup through the "hibernate.current_session_context_class"
@@ -110,7 +110,8 @@ public class SpringSessionContext implements CurrentSessionContext {
if (this.transactionManager.getStatus() == Status.STATUS_ACTIVE) {
Session session = this.jtaSessionContext.currentSession();
if (TransactionSynchronizationManager.isSynchronizationActive()) {
TransactionSynchronizationManager.registerSynchronization(new SpringFlushSynchronization(session));
TransactionSynchronizationManager.registerSynchronization(
new SpringFlushSynchronization(session));
}
return session;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -24,9 +24,9 @@ import org.springframework.transaction.support.ResourceHolderSupport;
import org.springframework.util.Assert;
/**
* Holder wrapping a JPA EntityManager.
* JpaTransactionManager binds instances of this class to the thread,
* for a given EntityManagerFactory.
* Resource holder wrapping a JPA {@link EntityManager}.
* {@link JpaTransactionManager} binds instances of this class to the thread,
* for a given {@link javax.persistence.EntityManagerFactory}.
*
* <p>Note: This is an SPI class, not intended to be used by applications.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -138,7 +138,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
/**
* Create a new JpaTransactionManager instance.
* @param emf EntityManagerFactory to manage transactions for
* @param emf the EntityManagerFactory to manage transactions for
*/
public JpaTransactionManager(EntityManagerFactory emf) {
this();
@@ -255,7 +255,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
* @see org.springframework.jdbc.core.JdbcTemplate
*/
public void setDataSource(@Nullable DataSource dataSource) {
if (dataSource != null && dataSource instanceof TransactionAwareDataSourceProxy) {
if (dataSource instanceof TransactionAwareDataSourceProxy) {
// If we got a TransactionAwareDataSourceProxy, we need to perform transactions
// for its underlying target DataSource, else data access code won't see
// properly exposed transactions (i.e. transactions for the target DataSource).