Skip to content

Commit 0a6da1e

Browse files
committed
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
2 parents 4849205 + 220d231 commit 0a6da1e

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/HibernateTransactionManager.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -150,8 +150,8 @@ public SessionFactory getSessionFactory() {
150150
* The DataSource should match the one used by the Hibernate SessionFactory:
151151
* for example, you could specify the same JNDI DataSource for both.
152152
* <p>If the SessionFactory was configured with LocalDataSourceConnectionProvider,
153-
* i.e. by Spring's SessionFactoryBuilder with a specified "dataSource",
154-
* the DataSource will be auto-detected: You can still explictly specify the
153+
* i.e. by Spring's LocalSessionFactoryBean with a specified "dataSource",
154+
* the DataSource will be auto-detected: You can still explicitly specify the
155155
* DataSource, but you don't need to in this case.
156156
* <p>A transactional JDBC Connection for this DataSource will be provided to
157157
* application code accessing this DataSource directly via DataSourceUtils
@@ -188,7 +188,7 @@ public DataSource getDataSource() {
188188

189189
/**
190190
* Set whether to autodetect a JDBC DataSource used by the Hibernate SessionFactory,
191-
* if set via SessionFactoryBuilder's {@code setDataSource}. Default is "true".
191+
* if set via LocalSessionFactoryBean's {@code setDataSource}. Default is "true".
192192
* <p>Can be turned off to deliberately ignore an available DataSource, in order
193193
* to not expose Hibernate transactions as JDBC transactions for that DataSource.
194194
* @see #setDataSource
@@ -358,7 +358,7 @@ protected void doBegin(Object transaction, TransactionDefinition definition) {
358358
}
359359

360360
if (definition.isReadOnly() && txObject.isNewSession()) {
361-
// Just set to NEVER in case of a new Session for this transaction.
361+
// Just set to MANUAL in case of a new Session for this transaction.
362362
session.setFlushMode(FlushMode.MANUAL);
363363
}
364364

@@ -586,7 +586,7 @@ protected boolean isSameConnectionForEntireSession(Session session) {
586586
* from the {@code org.springframework.dao} hierarchy.
587587
* <p>Will automatically apply a specified SQLExceptionTranslator to a
588588
* Hibernate JDBCException, else rely on Hibernate's default translation.
589-
* @param ex HibernateException that occured
589+
* @param ex HibernateException that occurred
590590
* @return a corresponding DataAccessException
591591
* @see SessionFactoryUtils#convertHibernateAccessException
592592
*/

spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBean.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,6 +58,7 @@
5858
* @since 3.1
5959
* @see #setDataSource
6060
* @see #setPackagesToScan
61+
* @see LocalSessionFactoryBuilder
6162
*/
6263
public class LocalSessionFactoryBean extends HibernateExceptionTranslator
6364
implements FactoryBean<SessionFactory>, ResourceLoaderAware, InitializingBean, DisposableBean {

spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTransactionManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -196,7 +196,7 @@ public SessionFactory getSessionFactory() {
196196
* for example, you could specify the same JNDI DataSource for both.
197197
* <p>If the SessionFactory was configured with LocalDataSourceConnectionProvider,
198198
* i.e. by Spring's LocalSessionFactoryBean with a specified "dataSource",
199-
* the DataSource will be auto-detected: You can still explictly specify the
199+
* the DataSource will be auto-detected: You can still explicitly specify the
200200
* DataSource, but you don't need to in this case.
201201
* <p>A transactional JDBC Connection for this DataSource will be provided to
202202
* application code accessing this DataSource directly via DataSourceUtils
@@ -527,7 +527,7 @@ protected void doBegin(Object transaction, TransactionDefinition definition) {
527527
}
528528

529529
if (definition.isReadOnly() && txObject.isNewSession()) {
530-
// Just set to NEVER in case of a new Session for this transaction.
530+
// Just set to MANUAL in case of a new Session for this transaction.
531531
session.setFlushMode(FlushMode.MANUAL);
532532
}
533533

@@ -779,7 +779,7 @@ protected boolean isSameConnectionForEntireSession(Session session) {
779779
* from the {@code org.springframework.dao} hierarchy.
780780
* <p>Will automatically apply a specified SQLExceptionTranslator to a
781781
* Hibernate JDBCException, else rely on Hibernate's default translation.
782-
* @param ex HibernateException that occured
782+
* @param ex HibernateException that occurred
783783
* @return a corresponding DataAccessException
784784
* @see SessionFactoryUtils#convertHibernateAccessException
785785
* @see #setJdbcExceptionTranslator
@@ -798,7 +798,7 @@ else if (GenericJDBCException.class.equals(ex.getClass())) {
798798
* Convert the given Hibernate JDBCException to an appropriate exception
799799
* from the {@code org.springframework.dao} hierarchy, using the
800800
* given SQLExceptionTranslator.
801-
* @param ex Hibernate JDBCException that occured
801+
* @param ex Hibernate JDBCException that occurred
802802
* @param translator the SQLExceptionTranslator to use
803803
* @return a corresponding DataAccessException
804804
*/

spring-orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -621,7 +621,7 @@ public static void applyTransactionTimeout(Criteria criteria, SessionFactory ses
621621
/**
622622
* Convert the given HibernateException to an appropriate exception
623623
* from the {@code org.springframework.dao} hierarchy.
624-
* @param ex HibernateException that occured
624+
* @param ex HibernateException that occurred
625625
* @return the corresponding DataAccessException instance
626626
* @see HibernateAccessor#convertHibernateAccessException
627627
* @see HibernateTransactionManager#convertHibernateAccessException

src/reference/docbook/migration-3.2.xml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,14 @@
138138
depend on JUnit 4.11 (<literal>junit:junit</literal>), TestNG 6.5.2
139139
(<literal>org.testng:testng</literal>), and Hamcrest Core 1.3
140140
(<literal>org.hamcrest:hamcrest-core</literal>). Each of these
141-
dependencies is declared as an <emphasis>optional</emphasis> dependency
142-
in the Maven POM. Furthermore, it is important to note that the JUnit
143-
team has stopped inlining Hamcrest Core within the
144-
<literal>junit:junit</literal> Maven artifact as of JUnit 4.11. Thus, if
145-
your existing JUnit-based tests make use of Hamcrest matchers that were
146-
previously available directly within the <literal>junit:junit</literal>
147-
JAR, you will now need to explicitly declare a dependency on
148-
<literal>org.hamcrest:hamcrest-core</literal>,
149-
<literal>org.hamcrest:hamcrest-library</literal>, or
150-
<literal>org.hamcrest:hamcrest-all</literal>.</para>
141+
dependencies is declared as an <emphasis>optional</emphasis> dependency in
142+
the Maven POM. Furthermore, it is important to note that the JUnit team
143+
has stopped inlining Hamcrest Core within the
144+
<literal>junit:junit</literal> Maven artifact as of JUnit 4.11. Hamcrest
145+
Core is now a <emphasis>required</emphasis> transitive dependency of
146+
<literal>junit</literal>, and users may therefore need to remove any
147+
exclusions on <literal>hamcrest-core</literal> that they had previously
148+
configured for their build.</para>
151149
</section>
152150

153151
<section xml:id="migration-3.2-changes">

0 commit comments

Comments
 (0)