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:
commit
0a6da1e42d
|
|
@ -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");
|
||||
* 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:
|
||||
* for example, you could specify the same JNDI DataSource for both.
|
||||
* <p>If the SessionFactory was configured with LocalDataSourceConnectionProvider,
|
||||
* i.e. by Spring's SessionFactoryBuilder with a specified "dataSource",
|
||||
* the DataSource will be auto-detected: You can still explictly specify the
|
||||
* i.e. by Spring's LocalSessionFactoryBean with a specified "dataSource",
|
||||
* the DataSource will be auto-detected: You can still explicitly specify the
|
||||
* DataSource, but you don't need to in this case.
|
||||
* <p>A transactional JDBC Connection for this DataSource will be provided to
|
||||
* 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,
|
||||
* 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
|
||||
* to not expose Hibernate transactions as JDBC transactions for that DataSource.
|
||||
* @see #setDataSource
|
||||
|
|
@ -358,7 +358,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -586,7 +586,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 occured
|
||||
* @param ex HibernateException that occurred
|
||||
* @return a corresponding DataAccessException
|
||||
* @see SessionFactoryUtils#convertHibernateAccessException
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
* 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
|
||||
* @see #setDataSource
|
||||
* @see #setPackagesToScan
|
||||
* @see LocalSessionFactoryBuilder
|
||||
*/
|
||||
public class LocalSessionFactoryBean extends HibernateExceptionTranslator
|
||||
implements FactoryBean<SessionFactory>, ResourceLoaderAware, InitializingBean, DisposableBean {
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
* 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.
|
||||
* <p>If the SessionFactory was configured with LocalDataSourceConnectionProvider,
|
||||
* 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.
|
||||
* <p>A transactional JDBC Connection for this DataSource will be provided to
|
||||
* application code accessing this DataSource directly via DataSourceUtils
|
||||
|
|
@ -527,7 +527,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -779,7 +779,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 occured
|
||||
* @param ex HibernateException that occurred
|
||||
* @return a corresponding DataAccessException
|
||||
* @see SessionFactoryUtils#convertHibernateAccessException
|
||||
* @see #setJdbcExceptionTranslator
|
||||
|
|
@ -798,7 +798,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
|||
* Convert the given Hibernate JDBCException to an appropriate exception
|
||||
* from the {@code org.springframework.dao} hierarchy, using the
|
||||
* given SQLExceptionTranslator.
|
||||
* @param ex Hibernate JDBCException that occured
|
||||
* @param ex Hibernate JDBCException that occurred
|
||||
* @param translator the SQLExceptionTranslator to use
|
||||
* @return a corresponding DataAccessException
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
* 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
|
||||
* from the {@code org.springframework.dao} hierarchy.
|
||||
* @param ex HibernateException that occured
|
||||
* @param ex HibernateException that occurred
|
||||
* @return the corresponding DataAccessException instance
|
||||
* @see HibernateAccessor#convertHibernateAccessException
|
||||
* @see HibernateTransactionManager#convertHibernateAccessException
|
||||
|
|
|
|||
|
|
@ -138,16 +138,14 @@
|
|||
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.hamcrest:hamcrest-core</literal>). Each of these
|
||||
dependencies is declared as an <emphasis>optional</emphasis> dependency
|
||||
in the Maven POM. Furthermore, it is important to note that the JUnit
|
||||
team has stopped inlining Hamcrest Core within the
|
||||
<literal>junit:junit</literal> Maven artifact as of JUnit 4.11. Thus, if
|
||||
your existing JUnit-based tests make use of Hamcrest matchers that were
|
||||
previously available directly within the <literal>junit:junit</literal>
|
||||
JAR, you will now need to explicitly declare a dependency on
|
||||
<literal>org.hamcrest:hamcrest-core</literal>,
|
||||
<literal>org.hamcrest:hamcrest-library</literal>, or
|
||||
<literal>org.hamcrest:hamcrest-all</literal>.</para>
|
||||
dependencies is declared as an <emphasis>optional</emphasis> dependency in
|
||||
the Maven POM. Furthermore, it is important to note that the JUnit team
|
||||
has stopped inlining Hamcrest Core within the
|
||||
<literal>junit:junit</literal> Maven artifact as of JUnit 4.11. Hamcrest
|
||||
Core is now a <emphasis>required</emphasis> transitive dependency of
|
||||
<literal>junit</literal>, and users may therefore need to remove any
|
||||
exclusions on <literal>hamcrest-core</literal> that they had previously
|
||||
configured for their build.</para>
|
||||
</section>
|
||||
|
||||
<section xml:id="migration-3.2-changes">
|
||||
|
|
|
|||
Loading…
Reference in New Issue