HHH-7894 failing test due to EntityNotFoundDelegate is not set to the SFbuilder

This commit is contained in:
Strong Liu 2012-12-28 17:20:57 +08:00
parent 2d43576045
commit 1cd75bbdd4
2 changed files with 6 additions and 3 deletions

View File

@ -33,7 +33,6 @@ import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.test.jpa.AbstractJPATest; import org.hibernate.test.jpa.AbstractJPATest;
import org.hibernate.test.jpa.Item; import org.hibernate.test.jpa.Item;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
@ -45,7 +44,6 @@ import static org.junit.Assert.fail;
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@FailureExpectedWithNewMetamodel
public class JPAProxyTest extends AbstractJPATest { public class JPAProxyTest extends AbstractJPATest {
@Test @Test
public void testEjb3ProxyUsage() { public void testEjb3ProxyUsage() {

View File

@ -62,6 +62,7 @@ import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property; import org.hibernate.mapping.Property;
import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.SimpleValue;
import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.SessionFactoryBuilder;
import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.metamodel.spi.MetadataImplementor;
import org.hibernate.metamodel.spi.binding.AbstractPluralAttributeBinding; import org.hibernate.metamodel.spi.binding.AbstractPluralAttributeBinding;
import org.hibernate.metamodel.spi.binding.AttributeBinding; import org.hibernate.metamodel.spi.binding.AttributeBinding;
@ -163,7 +164,11 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
metadataImplementor = buildMetadata( bootRegistry, serviceRegistry ); metadataImplementor = buildMetadata( bootRegistry, serviceRegistry );
afterConstructAndConfigureMetadata( metadataImplementor ); afterConstructAndConfigureMetadata( metadataImplementor );
applyCacheSettings(metadataImplementor); applyCacheSettings(metadataImplementor);
sessionFactory = ( SessionFactoryImplementor ) metadataImplementor.buildSessionFactory(); SessionFactoryBuilder sessionFactoryBuilder = metadataImplementor.getSessionFactoryBuilder();
if(configuration.getEntityNotFoundDelegate()!=null){
sessionFactoryBuilder.with( configuration.getEntityNotFoundDelegate() );
}
sessionFactory = ( SessionFactoryImplementor )sessionFactoryBuilder.build();
} }
else { else {
// this is done here because Configuration does not currently support 4.0 xsd // this is done here because Configuration does not currently support 4.0 xsd