Skip to content

Commit 4233d0a

Browse files
committed
Removed outdated hibernate3 references across the codebase
Issue: SPR-9028 (cherry picked from commit 09e2e58)
1 parent ad91610 commit 4233d0a

File tree

13 files changed

+67
-78
lines changed

13 files changed

+67
-78
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -278,9 +278,7 @@ public void setEntityInterceptorBeanName(String entityInterceptorBeanName) {
278278
* Will get applied to any new Session created by this transaction manager.
279279
* <p>Such an interceptor can either be set at the SessionFactory level,
280280
* i.e. on LocalSessionFactoryBean, or at the Session level, i.e. on
281-
* HibernateTemplate, HibernateInterceptor, and HibernateTransactionManager.
282-
* It's preferable to set it on LocalSessionFactoryBean or HibernateTransactionManager
283-
* to avoid repeated configuration and guarantee consistent behavior in transactions.
281+
* HibernateTransactionManager.
284282
* @see LocalSessionFactoryBean#setEntityInterceptor
285283
*/
286284
public void setEntityInterceptor(Interceptor entityInterceptor) {

spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java

Lines changed: 11 additions & 10 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-2014 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.
@@ -16,10 +16,17 @@
1616

1717
package org.springframework.orm.hibernate4.support;
1818

19+
import java.io.IOException;
20+
import javax.servlet.FilterChain;
21+
import javax.servlet.ServletException;
22+
import javax.servlet.http.HttpServletRequest;
23+
import javax.servlet.http.HttpServletResponse;
24+
1925
import org.hibernate.FlushMode;
2026
import org.hibernate.HibernateException;
2127
import org.hibernate.Session;
2228
import org.hibernate.SessionFactory;
29+
2330
import org.springframework.dao.DataAccessResourceFailureException;
2431
import org.springframework.orm.hibernate4.SessionFactoryUtils;
2532
import org.springframework.orm.hibernate4.SessionHolder;
@@ -30,12 +37,6 @@
3037
import org.springframework.web.context.support.WebApplicationContextUtils;
3138
import org.springframework.web.filter.OncePerRequestFilter;
3239

33-
import javax.servlet.FilterChain;
34-
import javax.servlet.ServletException;
35-
import javax.servlet.http.HttpServletRequest;
36-
import javax.servlet.http.HttpServletResponse;
37-
import java.io.IOException;
38-
3940
/**
4041
* Servlet 2.3 Filter that binds a Hibernate Session to the thread for the entire
4142
* processing of the request. Intended for the "Open Session in View" pattern,
@@ -72,6 +73,7 @@
7273
* @see OpenSessionInViewInterceptor
7374
* @see org.springframework.orm.hibernate4.HibernateTransactionManager
7475
* @see org.springframework.transaction.support.TransactionSynchronizationManager
76+
* @see org.hibernate.SessionFactory#getCurrentSession()
7577
*/
7678
public class OpenSessionInViewFilter extends OncePerRequestFilter {
7779

@@ -190,9 +192,8 @@ protected SessionFactory lookupSessionFactory() {
190192

191193
/**
192194
* Open a Session for the SessionFactory that this filter uses.
193-
* <p>The default implementation delegates to the
194-
* {@code SessionFactory.openSession} method and
195-
* sets the {@code Session}'s flush mode to "MANUAL".
195+
* <p>The default implementation delegates to the {@link SessionFactory#openSession}
196+
* method and sets the {@link Session}'s flush mode to "MANUAL".
196197
* @param sessionFactory the SessionFactory that this filter uses
197198
* @return the Session to use
198199
* @throws DataAccessResourceFailureException if the Session could not be created

spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewInterceptor.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -62,6 +62,7 @@
6262
* @see OpenSessionInViewFilter
6363
* @see org.springframework.orm.hibernate4.HibernateTransactionManager
6464
* @see org.springframework.transaction.support.TransactionSynchronizationManager
65+
* @see org.hibernate.SessionFactory#getCurrentSession()
6566
*/
6667
public class OpenSessionInViewInterceptor implements AsyncWebRequestInterceptor {
6768

@@ -79,16 +80,14 @@ public class OpenSessionInViewInterceptor implements AsyncWebRequestInterceptor
7980

8081

8182
/**
82-
* Set the Hibernate SessionFactory that should be used to create
83-
* Hibernate Sessions.
83+
* Set the Hibernate SessionFactory that should be used to create Hibernate Sessions.
8484
*/
8585
public void setSessionFactory(SessionFactory sessionFactory) {
8686
this.sessionFactory = sessionFactory;
8787
}
8888

8989
/**
90-
* Return the Hibernate SessionFactory that should be used to create
91-
* Hibernate Sessions.
90+
* Return the Hibernate SessionFactory that should be used to create Hibernate Sessions.
9291
*/
9392
public SessionFactory getSessionFactory() {
9493
return this.sessionFactory;
@@ -169,9 +168,8 @@ public void afterConcurrentHandlingStarted(WebRequest request) {
169168

170169
/**
171170
* Open a Session for the SessionFactory that this interceptor uses.
172-
* <p>The default implementation delegates to the
173-
* {@code SessionFactory.openSession} method and
174-
* sets the {@code Session}'s flush mode to "MANUAL".
171+
* <p>The default implementation delegates to the {@link SessionFactory#openSession}
172+
* method and sets the {@link Session}'s flush mode to "MANUAL".
175173
* @return the Session to use
176174
* @throws DataAccessResourceFailureException if the Session could not be created
177175
* @see org.hibernate.FlushMode#MANUAL

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,19 @@
6363
* configuration just adds value when fine-tuning Session settings like the flush mode
6464
* - or when relying on exception translation.
6565
*
66+
* <p>This class is effectively deprecated, in favor of either HibernateTemplate usage
67+
* or native Hibernate API usage within transactions, in combination with a general
68+
* {@link org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor}.
69+
* <b>Note: This class does not have an equivalent replacement in {@code orm.hibernate4}.
70+
* It is officially deprecated in the Spring 4.0.x line, superseded by a streamlined
71+
* OpenSessionInterceptor which also exists in 4.0.2's {@code orm.hibernate4} package.</b>
72+
*
6673
* @author Juergen Hoeller
6774
* @since 1.2
6875
* @see org.hibernate.SessionFactory#getCurrentSession()
6976
* @see HibernateTransactionManager
7077
* @see HibernateTemplate
71-
* @deprecated as of Spring 3.2.7, in favor of either HibernateTemplate usage or
72-
* native Hibernate API usage within transactions, in combination with a general
73-
* {@link org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor}.
74-
* Note: This class does not have an equivalent replacement in {@code orm.hibernate4}.
7578
*/
76-
@Deprecated
7779
public class HibernateInterceptor extends HibernateAccessor implements MethodInterceptor {
7880

7981
private boolean exceptionConversionEnabled = true;

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -214,8 +214,7 @@ public static Session getSession(SessionFactory sessionFactory, boolean allowCre
214214
* <p>Supports setting a Session-level Hibernate entity interceptor that allows
215215
* to inspect and change property values before writing to and reading from the
216216
* database. Such an interceptor can also be set at the SessionFactory level
217-
* (i.e. on LocalSessionFactoryBean), on HibernateTransactionManager, or on
218-
* HibernateInterceptor/HibernateTemplate.
217+
* (i.e. on LocalSessionFactoryBean), on HibernateTransactionManager, etc.
219218
* @param sessionFactory Hibernate SessionFactory to create the session with
220219
* @param entityInterceptor Hibernate entity interceptor, or {@code null} if none
221220
* @param jdbcExceptionTranslator SQLExcepionTranslator to use for flushing the
@@ -224,7 +223,6 @@ public static Session getSession(SessionFactory sessionFactory, boolean allowCre
224223
* @return the Hibernate Session
225224
* @throws DataAccessResourceFailureException if the Session couldn't be created
226225
* @see LocalSessionFactoryBean#setEntityInterceptor
227-
* @see HibernateInterceptor#setEntityInterceptor
228226
* @see HibernateTemplate#setEntityInterceptor
229227
*/
230228
public static Session getSession(
@@ -371,8 +369,8 @@ private static Session doGetSession(
371369
* @throws DataAccessResourceFailureException if the Session couldn't be created
372370
*/
373371
private static Session getJtaSynchronizedSession(
374-
SessionHolder sessionHolder, SessionFactory sessionFactory,
375-
SQLExceptionTranslator jdbcExceptionTranslator) throws DataAccessResourceFailureException {
372+
SessionHolder sessionHolder, SessionFactory sessionFactory,
373+
SQLExceptionTranslator jdbcExceptionTranslator) throws DataAccessResourceFailureException {
376374

377375
// JTA synchronization is only possible with a javax.transaction.TransactionManager.
378376
// We'll check the Hibernate SessionFactory: If a TransactionManagerLookup is specified

spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java

Lines changed: 6 additions & 4 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-2014 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.
@@ -17,7 +17,6 @@
1717
package org.springframework.orm.hibernate3.support;
1818

1919
import java.io.IOException;
20-
2120
import javax.servlet.FilterChain;
2221
import javax.servlet.ServletException;
2322
import javax.servlet.http.HttpServletRequest;
@@ -26,13 +25,15 @@
2625
import org.hibernate.FlushMode;
2726
import org.hibernate.Session;
2827
import org.hibernate.SessionFactory;
28+
2929
import org.springframework.dao.DataAccessResourceFailureException;
3030
import org.springframework.orm.hibernate3.SessionFactoryUtils;
3131
import org.springframework.orm.hibernate3.SessionHolder;
3232
import org.springframework.transaction.support.TransactionSynchronizationManager;
3333
import org.springframework.util.Assert;
3434
import org.springframework.web.context.WebApplicationContext;
35-
import org.springframework.web.context.request.async.*;
35+
import org.springframework.web.context.request.async.WebAsyncManager;
36+
import org.springframework.web.context.request.async.WebAsyncUtils;
3637
import org.springframework.web.context.support.WebApplicationContextUtils;
3738
import org.springframework.web.filter.OncePerRequestFilter;
3839

@@ -91,6 +92,7 @@
9192
* @see org.springframework.orm.hibernate3.HibernateTransactionManager
9293
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession
9394
* @see org.springframework.transaction.support.TransactionSynchronizationManager
95+
* @see org.hibernate.SessionFactory#getCurrentSession()
9496
*/
9597
public class OpenSessionInViewFilter extends OncePerRequestFilter {
9698

@@ -165,7 +167,7 @@ protected FlushMode getFlushMode() {
165167
}
166168

167169
/**
168-
* The default value is "false" so that the filter may re-bind the opened
170+
* Returns "false" so that the filter may re-bind the opened Hibernate
169171
* {@code Session} to each asynchronously dispatched thread and postpone
170172
* closing it until the very last asynchronous dispatch.
171173
*/

spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewInterceptor.java

Lines changed: 6 additions & 7 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-2014 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.
@@ -16,20 +16,19 @@
1616

1717
package org.springframework.orm.hibernate3.support;
1818

19-
import java.util.concurrent.Callable;
20-
2119
import org.hibernate.HibernateException;
2220
import org.hibernate.Session;
21+
2322
import org.springframework.dao.DataAccessException;
2423
import org.springframework.orm.hibernate3.HibernateAccessor;
2524
import org.springframework.orm.hibernate3.SessionFactoryUtils;
2625
import org.springframework.orm.hibernate3.SessionHolder;
2726
import org.springframework.transaction.support.TransactionSynchronizationManager;
2827
import org.springframework.ui.ModelMap;
2928
import org.springframework.web.context.request.AsyncWebRequestInterceptor;
30-
import org.springframework.web.context.request.NativeWebRequest;
3129
import org.springframework.web.context.request.WebRequest;
32-
import org.springframework.web.context.request.async.*;
30+
import org.springframework.web.context.request.async.WebAsyncManager;
31+
import org.springframework.web.context.request.async.WebAsyncUtils;
3332

3433
/**
3534
* Spring web request interceptor that binds a Hibernate {@code Session} to the
@@ -91,6 +90,7 @@
9190
* @see org.springframework.orm.hibernate3.HibernateTransactionManager
9291
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession
9392
* @see org.springframework.transaction.support.TransactionSynchronizationManager
93+
* @see org.hibernate.SessionFactory#getCurrentSession()
9494
*/
9595
public class OpenSessionInViewInterceptor extends HibernateAccessor implements AsyncWebRequestInterceptor {
9696

@@ -143,10 +143,9 @@ protected boolean isSingleSession() {
143143
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession
144144
*/
145145
public void preHandle(WebRequest request) throws DataAccessException {
146-
147-
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
148146
String participateAttributeName = getParticipateAttributeName();
149147

148+
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
150149
if (asyncManager.hasConcurrentResult()) {
151150
if (applySessionBindingInterceptor(asyncManager, participateAttributeName)) {
152151
return;

spring-tx/src/main/java/org/springframework/dao/annotation/PersistenceExceptionTranslationPostProcessor.java

Lines changed: 7 additions & 8 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-2014 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.
@@ -40,13 +40,12 @@
4040
* candidate exceptions.
4141
*
4242
43-
* <p>All of Spring's applicable resource factories (e.g. {@link
44-
* org.springframework.orm.hibernate3.LocalSessionFactoryBean LocalSessionFactoryBean},
45-
* {@link org.springframework.orm.jpa.LocalEntityManagerFactoryBean
46-
* LocalEntityManagerFactoryBean}) implement the {@code PersistenceExceptionTranslator}
47-
* interface out of the box. As a consequence, all that is usually needed to enable
48-
* automatic exception translation is marking all affected beans (such as Repositories or
49-
* DAOs) with the {@code @Repository} annotation, along with defining this post-processor
43+
* <p>All of Spring's applicable resource factories (e.g.
44+
* {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean})
45+
* implement the {@code PersistenceExceptionTranslator} interface out of the box.
46+
* As a consequence, all that is usually needed to enable automatic exception
47+
* translation is marking all affected beans (such as Repositories or DAOs)
48+
* with the {@code @Repository} annotation, along with defining this post-processor
5049
* as a bean in the application context.
5150
*
5251
* @author Rod Johnson

spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -69,9 +69,7 @@
6969
*
7070
* <p>The "preInterceptors" and "postInterceptors" properties can be set to add
7171
* additional interceptors to the mix, like
72-
* {@link org.springframework.aop.interceptor.PerformanceMonitorInterceptor} or
73-
* {@link org.springframework.orm.hibernate3.HibernateInterceptor} /
74-
* {@link org.springframework.orm.jdo.JdoInterceptor}.
72+
* {@link org.springframework.aop.interceptor.PerformanceMonitorInterceptor}.
7573
*
7674
* <p><b>HINT:</b> This class is often used with parent / child bean definitions.
7775
* Typically, you will define the transaction manager and default transaction

spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronization.java

Lines changed: 1 addition & 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-2014 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.
@@ -32,7 +32,6 @@
3232
* @see TransactionSynchronizationManager
3333
* @see AbstractPlatformTransactionManager
3434
* @see org.springframework.jdbc.datasource.DataSourceUtils#CONNECTION_SYNCHRONIZATION_ORDER
35-
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#SESSION_SYNCHRONIZATION_ORDER
3635
*/
3736
public interface TransactionSynchronization {
3837

0 commit comments

Comments
 (0)