Merge branch '3.2.x' into cleanup-3.2.x

* 3.2.x:
  Polish documentation in Hibernate support classes
  Improve 3.2 migration guide re: JUnit & Hamcrest
This commit is contained in:
Phillip Webb 2013-02-04 10:29:05 -08:00
commit 0a6da1e42d
5 changed files with 23 additions and 24 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -150,8 +150,8 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* The DataSource should match the one used by the Hibernate SessionFactory: * The DataSource should match the one used by the Hibernate SessionFactory:
* for example, you could specify the same JNDI DataSource for both. * for example, you could specify the same JNDI DataSource for both.
* <p>If the SessionFactory was configured with LocalDataSourceConnectionProvider, * <p>If the SessionFactory was configured with LocalDataSourceConnectionProvider,
* i.e. by Spring's SessionFactoryBuilder with a specified "dataSource", * i.e. by Spring's LocalSessionFactoryBean with a specified "dataSource",
* the DataSource will be auto-detected: You can still explictly specify the * the DataSource will be auto-detected: You can still explicitly specify the
* DataSource, but you don't need to in this case. * DataSource, but you don't need to in this case.
* <p>A transactional JDBC Connection for this DataSource will be provided to * <p>A transactional JDBC Connection for this DataSource will be provided to
* application code accessing this DataSource directly via DataSourceUtils * application code accessing this DataSource directly via DataSourceUtils
@ -188,7 +188,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
/** /**
* Set whether to autodetect a JDBC DataSource used by the Hibernate SessionFactory, * Set whether to autodetect a JDBC DataSource used by the Hibernate SessionFactory,
* if set via SessionFactoryBuilder's {@code setDataSource}. Default is "true". * if set via LocalSessionFactoryBean's {@code setDataSource}. Default is "true".
* <p>Can be turned off to deliberately ignore an available DataSource, in order * <p>Can be turned off to deliberately ignore an available DataSource, in order
* to not expose Hibernate transactions as JDBC transactions for that DataSource. * to not expose Hibernate transactions as JDBC transactions for that DataSource.
* @see #setDataSource * @see #setDataSource
@ -358,7 +358,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
} }
if (definition.isReadOnly() && txObject.isNewSession()) { if (definition.isReadOnly() && txObject.isNewSession()) {
// Just set to NEVER in case of a new Session for this transaction. // Just set to MANUAL in case of a new Session for this transaction.
session.setFlushMode(FlushMode.MANUAL); session.setFlushMode(FlushMode.MANUAL);
} }
@ -586,7 +586,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* from the {@code org.springframework.dao} hierarchy. * from the {@code org.springframework.dao} hierarchy.
* <p>Will automatically apply a specified SQLExceptionTranslator to a * <p>Will automatically apply a specified SQLExceptionTranslator to a
* Hibernate JDBCException, else rely on Hibernate's default translation. * Hibernate JDBCException, else rely on Hibernate's default translation.
* @param ex HibernateException that occured * @param ex HibernateException that occurred
* @return a corresponding DataAccessException * @return a corresponding DataAccessException
* @see SessionFactoryUtils#convertHibernateAccessException * @see SessionFactoryUtils#convertHibernateAccessException
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -58,6 +58,7 @@ import org.springframework.core.io.support.ResourcePatternUtils;
* @since 3.1 * @since 3.1
* @see #setDataSource * @see #setDataSource
* @see #setPackagesToScan * @see #setPackagesToScan
* @see LocalSessionFactoryBuilder
*/ */
public class LocalSessionFactoryBean extends HibernateExceptionTranslator public class LocalSessionFactoryBean extends HibernateExceptionTranslator
implements FactoryBean<SessionFactory>, ResourceLoaderAware, InitializingBean, DisposableBean { implements FactoryBean<SessionFactory>, ResourceLoaderAware, InitializingBean, DisposableBean {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -196,7 +196,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* for example, you could specify the same JNDI DataSource for both. * for example, you could specify the same JNDI DataSource for both.
* <p>If the SessionFactory was configured with LocalDataSourceConnectionProvider, * <p>If the SessionFactory was configured with LocalDataSourceConnectionProvider,
* i.e. by Spring's LocalSessionFactoryBean with a specified "dataSource", * i.e. by Spring's LocalSessionFactoryBean with a specified "dataSource",
* the DataSource will be auto-detected: You can still explictly specify the * the DataSource will be auto-detected: You can still explicitly specify the
* DataSource, but you don't need to in this case. * DataSource, but you don't need to in this case.
* <p>A transactional JDBC Connection for this DataSource will be provided to * <p>A transactional JDBC Connection for this DataSource will be provided to
* application code accessing this DataSource directly via DataSourceUtils * application code accessing this DataSource directly via DataSourceUtils
@ -527,7 +527,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
} }
if (definition.isReadOnly() && txObject.isNewSession()) { if (definition.isReadOnly() && txObject.isNewSession()) {
// Just set to NEVER in case of a new Session for this transaction. // Just set to MANUAL in case of a new Session for this transaction.
session.setFlushMode(FlushMode.MANUAL); session.setFlushMode(FlushMode.MANUAL);
} }
@ -779,7 +779,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* from the {@code org.springframework.dao} hierarchy. * from the {@code org.springframework.dao} hierarchy.
* <p>Will automatically apply a specified SQLExceptionTranslator to a * <p>Will automatically apply a specified SQLExceptionTranslator to a
* Hibernate JDBCException, else rely on Hibernate's default translation. * Hibernate JDBCException, else rely on Hibernate's default translation.
* @param ex HibernateException that occured * @param ex HibernateException that occurred
* @return a corresponding DataAccessException * @return a corresponding DataAccessException
* @see SessionFactoryUtils#convertHibernateAccessException * @see SessionFactoryUtils#convertHibernateAccessException
* @see #setJdbcExceptionTranslator * @see #setJdbcExceptionTranslator
@ -798,7 +798,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
* Convert the given Hibernate JDBCException to an appropriate exception * Convert the given Hibernate JDBCException to an appropriate exception
* from the {@code org.springframework.dao} hierarchy, using the * from the {@code org.springframework.dao} hierarchy, using the
* given SQLExceptionTranslator. * given SQLExceptionTranslator.
* @param ex Hibernate JDBCException that occured * @param ex Hibernate JDBCException that occurred
* @param translator the SQLExceptionTranslator to use * @param translator the SQLExceptionTranslator to use
* @return a corresponding DataAccessException * @return a corresponding DataAccessException
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -621,7 +621,7 @@ public abstract class SessionFactoryUtils {
/** /**
* Convert the given HibernateException to an appropriate exception * Convert the given HibernateException to an appropriate exception
* from the {@code org.springframework.dao} hierarchy. * from the {@code org.springframework.dao} hierarchy.
* @param ex HibernateException that occured * @param ex HibernateException that occurred
* @return the corresponding DataAccessException instance * @return the corresponding DataAccessException instance
* @see HibernateAccessor#convertHibernateAccessException * @see HibernateAccessor#convertHibernateAccessException
* @see HibernateTransactionManager#convertHibernateAccessException * @see HibernateTransactionManager#convertHibernateAccessException

View File

@ -138,16 +138,14 @@
depend on JUnit 4.11 (<literal>junit:junit</literal>), TestNG 6.5.2 depend on JUnit 4.11 (<literal>junit:junit</literal>), TestNG 6.5.2
(<literal>org.testng:testng</literal>), and Hamcrest Core 1.3 (<literal>org.testng:testng</literal>), and Hamcrest Core 1.3
(<literal>org.hamcrest:hamcrest-core</literal>). Each of these (<literal>org.hamcrest:hamcrest-core</literal>). Each of these
dependencies is declared as an <emphasis>optional</emphasis> dependency dependencies is declared as an <emphasis>optional</emphasis> dependency in
in the Maven POM. Furthermore, it is important to note that the JUnit the Maven POM. Furthermore, it is important to note that the JUnit team
team has stopped inlining Hamcrest Core within the has stopped inlining Hamcrest Core within the
<literal>junit:junit</literal> Maven artifact as of JUnit 4.11. Thus, if <literal>junit:junit</literal> Maven artifact as of JUnit 4.11. Hamcrest
your existing JUnit-based tests make use of Hamcrest matchers that were Core is now a <emphasis>required</emphasis> transitive dependency of
previously available directly within the <literal>junit:junit</literal> <literal>junit</literal>, and users may therefore need to remove any
JAR, you will now need to explicitly declare a dependency on exclusions on <literal>hamcrest-core</literal> that they had previously
<literal>org.hamcrest:hamcrest-core</literal>, configured for their build.</para>
<literal>org.hamcrest:hamcrest-library</literal>, or
<literal>org.hamcrest:hamcrest-all</literal>.</para>
</section> </section>
<section xml:id="migration-3.2-changes"> <section xml:id="migration-3.2-changes">