diff --git a/org.springframework.integration-tests/src/test/java/org/springframework/orm/hibernate3/HibernateSessionFactoryConfigurationTests.java b/org.springframework.integration-tests/src/test/java/org/springframework/orm/hibernate3/HibernateSessionFactoryConfigurationTests.java index 66344b54be..3f9df777ad 100644 --- a/org.springframework.integration-tests/src/test/java/org/springframework/orm/hibernate3/HibernateSessionFactoryConfigurationTests.java +++ b/org.springframework.integration-tests/src/test/java/org/springframework/orm/hibernate3/HibernateSessionFactoryConfigurationTests.java @@ -33,6 +33,7 @@ import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.classic.Session; +import org.hibernate.engine.SessionFactoryImplementor; import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.BeanCreationException; @@ -131,10 +132,11 @@ public class HibernateSessionFactoryConfigurationTests { } @Test - public void builtSessionFactoryIsDisposableBeanProxy() { + public void builtSessionFactoryIsProxyImplementingDisposableBeanAndSessionFactoryImplementor() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(AnnotationSessionFactoryConfig.class); SessionFactory sessionFactory = ctx.getBean(SessionFactory.class); assertThat(sessionFactory, instanceOf(DisposableBean.class)); + assertThat(sessionFactory, instanceOf(SessionFactoryImplementor.class)); assertThat(sessionFactory.toString(), startsWith("DisposableBean proxy for SessionFactory")); ctx.close(); assertTrue("SessionFactory was not closed as expected", sessionFactory.isClosed()); diff --git a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryBuilderSupport.java b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryBuilderSupport.java index a9a2295b12..8068ab91ac 100644 --- a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryBuilderSupport.java +++ b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryBuilderSupport.java @@ -232,8 +232,9 @@ public abstract class SessionFactoryBuilderSupportSubclasses may override this to implement transaction awareness through * a {@code SessionFactory} proxy for example, or even to avoid creation of the * {@code DisposableBean} proxy altogether. - * @param rawSf the raw {@code SessionFactory} as built by {@link #buildSessionFactory()} - * @return the {@code SessionFactory} reference to expose + * @param rawSf the raw {@code SessionFactory} as built by {@link #doBuildSessionFactory()} + * @return a proxied {@code SessionFactory} if wrapping was necessary, otherwise the + * original given 'raw' {@code SessionFactory} object. * @see #buildSessionFactory() */ protected SessionFactory wrapSessionFactoryIfNecessary(final SessionFactory rawSf) { @@ -574,6 +577,7 @@ public abstract class SessionFactoryBuilderSupport[] { SessionFactory.class, + SessionFactoryImplementor.class, DisposableBean.class }, new InvocationHandler() {