Revert "Implement SessionFactoryImplementor in SF proxies"
This reverts commit 08ccd19c76.
Issue: SPR-8469
This commit is contained in:
parent
363e08df22
commit
b82d5ae8da
|
|
@ -33,7 +33,6 @@ 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;
|
||||
|
|
@ -132,11 +131,10 @@ public class HibernateSessionFactoryConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void builtSessionFactoryIsProxyImplementingDisposableBeanAndSessionFactoryImplementor() {
|
||||
public void builtSessionFactoryIsDisposableBeanProxy() {
|
||||
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());
|
||||
|
|
|
|||
|
|
@ -232,9 +232,8 @@ public abstract class SessionFactoryBuilderSupport<This extends SessionFactoryBu
|
|||
|
||||
/**
|
||||
* Build the underlying Hibernate SessionFactory.
|
||||
* @return the {@code SessionFactory}, potentially wrapped as a
|
||||
* {@code DisposableBean} and/or transaction-aware proxy before it is exposed to the
|
||||
* application.
|
||||
* @return the raw SessionFactory (potentially to be wrapped with a
|
||||
* transaction-aware proxy before it is exposed to the application)
|
||||
* @throws Exception in case of initialization failure
|
||||
*/
|
||||
public SessionFactory buildSessionFactory() throws Exception {
|
||||
|
|
@ -245,9 +244,8 @@ public abstract class SessionFactoryBuilderSupport<This extends SessionFactoryBu
|
|||
|
||||
/**
|
||||
* Populate the underlying {@code Configuration} instance with the various
|
||||
* properties of this builder, then return the raw session factory resulting from
|
||||
* calling {@link Configuration#buildSessionFactory()}. Customization may be performed
|
||||
* through {@code pre*} and {@code post*} methods.
|
||||
* properties of this builder. Customization may be performed through
|
||||
* {@code pre*} and {@code post*} methods.
|
||||
* @see #preBuildSessionFactory()
|
||||
* @see #postProcessMappings()
|
||||
* @see #postBuildSessionFactory()
|
||||
|
|
@ -555,9 +553,8 @@ public abstract class SessionFactoryBuilderSupport<This extends SessionFactoryBu
|
|||
* <p>Subclasses 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 #doBuildSessionFactory()}
|
||||
* @return a proxied {@code SessionFactory} if wrapping was necessary, otherwise the
|
||||
* original given 'raw' {@code SessionFactory} object.
|
||||
* @param rawSf the raw {@code SessionFactory} as built by {@link #buildSessionFactory()}
|
||||
* @return the {@code SessionFactory} reference to expose
|
||||
* @see #buildSessionFactory()
|
||||
*/
|
||||
protected SessionFactory wrapSessionFactoryIfNecessary(final SessionFactory rawSf) {
|
||||
|
|
@ -565,7 +562,6 @@ public abstract class SessionFactoryBuilderSupport<This extends SessionFactoryBu
|
|||
this.beanClassLoader,
|
||||
new Class<?>[] {
|
||||
SessionFactory.class,
|
||||
SessionFactoryImplementor.class,
|
||||
DisposableBean.class
|
||||
},
|
||||
new InvocationHandler() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue