Skip to content

Commit b82d5ae

Browse files
committed
Revert "Implement SessionFactoryImplementor in SF proxies"
This reverts commit 08ccd19. Issue: SPR-8469
1 parent 363e08d commit b82d5ae

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

org.springframework.integration-tests/src/test/java/org/springframework/orm/hibernate3/HibernateSessionFactoryConfigurationTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.hibernate.Transaction;
3434
import org.hibernate.cfg.AnnotationConfiguration;
3535
import org.hibernate.classic.Session;
36-
import org.hibernate.engine.SessionFactoryImplementor;
3736
import org.junit.Ignore;
3837
import org.junit.Test;
3938
import org.springframework.beans.factory.BeanCreationException;
@@ -132,11 +131,10 @@ public void usingSessionFactoryBuilder_withLateCustomConfigurationClass() throws
132131
}
133132

134133
@Test
135-
public void builtSessionFactoryIsProxyImplementingDisposableBeanAndSessionFactoryImplementor() {
134+
public void builtSessionFactoryIsDisposableBeanProxy() {
136135
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(AnnotationSessionFactoryConfig.class);
137136
SessionFactory sessionFactory = ctx.getBean(SessionFactory.class);
138137
assertThat(sessionFactory, instanceOf(DisposableBean.class));
139-
assertThat(sessionFactory, instanceOf(SessionFactoryImplementor.class));
140138
assertThat(sessionFactory.toString(), startsWith("DisposableBean proxy for SessionFactory"));
141139
ctx.close();
142140
assertTrue("SessionFactory was not closed as expected", sessionFactory.isClosed());

org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryBuilderSupport.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,8 @@ public SessionFactoryBuilderSupport(DataSource dataSource) {
232232

233233
/**
234234
* Build the underlying Hibernate SessionFactory.
235-
* @return the {@code SessionFactory}, potentially wrapped as a
236-
* {@code DisposableBean} and/or transaction-aware proxy before it is exposed to the
237-
* application.
235+
* @return the raw SessionFactory (potentially to be wrapped with a
236+
* transaction-aware proxy before it is exposed to the application)
238237
* @throws Exception in case of initialization failure
239238
*/
240239
public SessionFactory buildSessionFactory() throws Exception {
@@ -245,9 +244,8 @@ public SessionFactory buildSessionFactory() throws Exception {
245244

246245
/**
247246
* Populate the underlying {@code Configuration} instance with the various
248-
* properties of this builder, then return the raw session factory resulting from
249-
* calling {@link Configuration#buildSessionFactory()}. Customization may be performed
250-
* through {@code pre*} and {@code post*} methods.
247+
* properties of this builder. Customization may be performed through
248+
* {@code pre*} and {@code post*} methods.
251249
* @see #preBuildSessionFactory()
252250
* @see #postProcessMappings()
253251
* @see #postBuildSessionFactory()
@@ -555,17 +553,15 @@ protected void postBuildSessionFactory() {
555553
* <p>Subclasses may override this to implement transaction awareness through
556554
* a {@code SessionFactory} proxy for example, or even to avoid creation of the
557555
* {@code DisposableBean} proxy altogether.
558-
* @param rawSf the raw {@code SessionFactory} as built by {@link #doBuildSessionFactory()}
559-
* @return a proxied {@code SessionFactory} if wrapping was necessary, otherwise the
560-
* original given 'raw' {@code SessionFactory} object.
556+
* @param rawSf the raw {@code SessionFactory} as built by {@link #buildSessionFactory()}
557+
* @return the {@code SessionFactory} reference to expose
561558
* @see #buildSessionFactory()
562559
*/
563560
protected SessionFactory wrapSessionFactoryIfNecessary(final SessionFactory rawSf) {
564561
return (SessionFactory) Proxy.newProxyInstance(
565562
this.beanClassLoader,
566563
new Class<?>[] {
567564
SessionFactory.class,
568-
SessionFactoryImplementor.class,
569565
DisposableBean.class
570566
},
571567
new InvocationHandler() {

0 commit comments

Comments
 (0)