HHH-14450 - Drop ability to disable "enhanced proxies"

This commit is contained in:
Steve Ebersole 2021-02-10 13:11:35 -06:00
parent 15caff9cbc
commit 611796c0fc
69 changed files with 135 additions and 788 deletions

View File

@ -65,7 +65,6 @@ import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.tuple.entity.EntityTuplizerFactory;
import static org.hibernate.cfg.AvailableSettings.ACQUIRE_CONNECTIONS;
import static org.hibernate.cfg.AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY;
import static org.hibernate.cfg.AvailableSettings.ALLOW_JTA_TRANSACTION_ACCESS;
import static org.hibernate.cfg.AvailableSettings.ALLOW_REFRESH_DETACHED_ENTITY;
import static org.hibernate.cfg.AvailableSettings.ALLOW_UPDATE_OUTSIDE_TRANSACTION;
@ -197,7 +196,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
private boolean orderUpdatesEnabled;
private boolean orderInsertsEnabled;
private boolean postInsertIdentifierDelayed;
private boolean enhancementAsProxyEnabled;
private boolean collectionsInDefaultFetchGroupEnabled;
// JPA callbacks
@ -351,7 +349,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
this.defaultNullPrecedence = NullPrecedence.parse( defaultNullPrecedence );
this.orderUpdatesEnabled = ConfigurationHelper.getBoolean( ORDER_UPDATES, configurationSettings );
this.orderInsertsEnabled = ConfigurationHelper.getBoolean( ORDER_INSERTS, configurationSettings );
this.enhancementAsProxyEnabled = ConfigurationHelper.getBoolean( ALLOW_ENHANCEMENT_AS_PROXY, configurationSettings );
this.callbacksEnabled = ConfigurationHelper.getBoolean( JPA_CALLBACKS_ENABLED, configurationSettings, true );
@ -1063,11 +1060,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
return callbacksEnabled;
}
@Override
public boolean isEnhancementAsProxyEnabled() {
return enhancementAsProxyEnabled;
}
@Override
public boolean isCollectionsInDefaultFetchGroupEnabled() {
return collectionsInDefaultFetchGroupEnabled;

View File

@ -310,9 +310,12 @@ public interface SessionFactoryOptions {
/**
* Can bytecode-enhanced entity classes be used as a "proxy"?
*
* @deprecated (since 5.5) use of enhanced proxies is always enabled
*/
@Deprecated
default boolean isEnhancementAsProxyEnabled() {
return false;
return true;
}
default boolean isCollectionsInDefaultFetchGroupEnabled() {

View File

@ -31,7 +31,6 @@ public class EnhancementHelper {
public static boolean includeInBaseFetchGroup(
Property bootMapping,
boolean isEnhanced,
boolean allowEnhancementAsProxy,
boolean collectionsInDefaultFetchGroupEnabled) {
final Value value = bootMapping.getValue();
@ -57,7 +56,16 @@ public class EnhancementHelper {
}
// include it in the base fetch group so long as the config allows
// using the FK to create an "enhancement proxy"
return allowEnhancementAsProxy;
//return allowEnhancementAsProxy;
// ^^ previously we had to explicitly enable use of enhanced proxies.
// for the moment just return `true` assuming we can.
//
// there are cases where this block overall misses quite a few cases
// where it returns the least optimal value. This is true even outside
// this enhanced-proxy point
//
// those will all be addressed in the commits for HHH-13658
return true;
}
}

View File

@ -34,7 +34,6 @@ public class LazyAttributesMetadata implements Serializable {
public static LazyAttributesMetadata from(
PersistentClass mappedEntity,
boolean isEnhanced,
boolean allowEnhancementAsProxy,
boolean collectionsInDefaultFetchGroupEnabled) {
final Map<String, LazyAttributeDescriptor> lazyAttributeDescriptorMap = new LinkedHashMap<>();
final Map<String, Set<String>> fetchGroupToAttributesMap = new HashMap<>();
@ -48,7 +47,6 @@ public class LazyAttributesMetadata implements Serializable {
final boolean lazy = ! EnhancementHelper.includeInBaseFetchGroup(
property,
isEnhanced,
allowEnhancementAsProxy,
collectionsInDefaultFetchGroupEnabled
);
if ( lazy ) {

View File

@ -890,7 +890,11 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings {
* the results of those methods
*
* @implSpec See {@link org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor}
*
* @deprecated (as of 5.5) with no replacement. When using enhancement based lazy loading
* using the enhanced class as proxy is always used when appropriate.
*/
@Deprecated
String ALLOW_ENHANCEMENT_AS_PROXY = "hibernate.bytecode.allow_enhancement_as_proxy";
/**

View File

@ -252,10 +252,6 @@ public class DefaultLoadEventListener implements LoadEventListener {
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
final boolean allowBytecodeProxy = factory
.getSessionFactoryOptions()
.isEnhancementAsProxyEnabled();
final EntityMetamodel entityMetamodel = persister.getEntityMetamodel();
final boolean entityHasHibernateProxyFactory = entityMetamodel
.getTuplizer()
@ -263,7 +259,6 @@ public class DefaultLoadEventListener implements LoadEventListener {
// Check for the case where we can use the entity itself as a proxy
if ( options.isAllowProxyCreation()
&& allowBytecodeProxy
&& entityMetamodel.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading() ) {
// if there is already a managed entity instance associated with the PC, return it
final Object managed = persistenceContext.getEntity( keyToLoad );

View File

@ -364,8 +364,7 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener impleme
}
if ( incoming instanceof PersistentAttributeInterceptable
&& persister.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading()
&& source.getSessionFactory().getSessionFactoryOptions().isEnhancementAsProxyEnabled() ) {
&& persister.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading() ) {
final PersistentAttributeInterceptor incomingInterceptor = ( (PersistentAttributeInterceptable) incoming ).$$_hibernate_getInterceptor();
final PersistentAttributeInterceptor managedInterceptor = ( (PersistentAttributeInterceptable) managed ).$$_hibernate_getInterceptor();

View File

@ -70,12 +70,10 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
private final PersistenceContext temporaryPersistenceContext = new StatefulPersistenceContext( this );
private final boolean connectionProvided;
private final boolean allowBytecodeProxy;
public StatelessSessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) {
super( factory, options );
connectionProvided = options.getConnection() != null;
allowBytecodeProxy = getFactory().getSessionFactoryOptions().isEnhancementAsProxyEnabled();
}
@Override
@ -306,7 +304,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
final EntityMetamodel entityMetamodel = persister.getEntityMetamodel();
final BytecodeEnhancementMetadata bytecodeEnhancementMetadata = entityMetamodel.getBytecodeEnhancementMetadata();
if ( allowBytecodeProxy && bytecodeEnhancementMetadata.isEnhancedForLazyLoading() ) {
if ( bytecodeEnhancementMetadata.isEnhancedForLazyLoading() ) {
// if the entity defines a HibernateProxy factory, see if there is an
// existing proxy associated with the PC - and if so, use it

View File

@ -62,9 +62,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.engine.spi.SubselectFetch;
import org.hibernate.engine.spi.TypedValue;
import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.event.spi.EventSource;
import org.hibernate.event.spi.EventType;
import org.hibernate.event.spi.PostLoadEvent;
import org.hibernate.event.spi.PreLoadEvent;
import org.hibernate.event.spi.PreLoadEventListener;
@ -115,13 +113,10 @@ public abstract class Loader {
private final SessionFactoryImplementor factory;
private volatile ColumnNameCache columnNameCache;
private final boolean enhancementAsProxyEnabled;
private boolean isJdbc4 = true;
public Loader(SessionFactoryImplementor factory) {
this.factory = factory;
this.enhancementAsProxyEnabled = factory.getSessionFactoryOptions().isEnhancementAsProxyEnabled();
}
/**
@ -1662,7 +1657,7 @@ public abstract class Loader {
);
}
if ( enhancementAsProxyEnabled && persister.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading() ) {
if ( persister.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading() ) {
// we have found an existing "managed copy" in the session
// we need to check if this copy is an enhanced-proxy and, if so,
// perform the hydration just as if it were "not yet loaded"

View File

@ -249,7 +249,7 @@ public class Property implements Serializable, MetaAttributable {
* @apiNote This form reports whether the property is considered part of the
* base fetch group based solely on the mapping information. However,
* {@link EnhancementHelper#includeInBaseFetchGroup} is used internally to make that
* decision to account for {@link org.hibernate.cfg.AvailableSettings#ALLOW_ENHANCEMENT_AS_PROXY}
* decision to account for other details
*/
public boolean isLazy() {
if ( value instanceof ToOne ) {

View File

@ -743,7 +743,6 @@ public abstract class AbstractEntityPersister
final boolean lazy = ! EnhancementHelper.includeInBaseFetchGroup(
prop,
entityMetamodel.isInstrumented(),
sessionFactoryOptions.isEnhancementAsProxyEnabled(),
sessionFactoryOptions.isCollectionsInDefaultFetchGroupEnabled()
);
@ -821,7 +820,6 @@ public abstract class AbstractEntityPersister
final boolean lazy = ! EnhancementHelper.includeInBaseFetchGroup(
prop,
entityMetamodel.isInstrumented(),
sessionFactoryOptions.isEnhancementAsProxyEnabled(),
sessionFactoryOptions.isCollectionsInDefaultFetchGroupEnabled()
);
while ( colIter.hasNext() ) {

View File

@ -174,7 +174,6 @@ public final class PropertyFactory {
final boolean lazy = ! EnhancementHelper.includeInBaseFetchGroup(
property,
lazyAvailable,
sessionFactoryOptions.isEnhancementAsProxyEnabled(),
sessionFactoryOptions.isCollectionsInDefaultFetchGroupEnabled()
);

View File

@ -38,12 +38,11 @@ public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhanc
PersistentClass persistentClass,
Set<String> identifierAttributeNames,
CompositeType nonAggregatedCidMapper,
boolean allowEnhancementAsProxy,
boolean collectionsInDefaultFetchGroupEnabled) {
final Class mappedClass = persistentClass.getMappedClass();
final boolean enhancedForLazyLoading = PersistentAttributeInterceptable.class.isAssignableFrom( mappedClass );
final LazyAttributesMetadata lazyAttributesMetadata = enhancedForLazyLoading
? LazyAttributesMetadata.from( persistentClass, true, allowEnhancementAsProxy, collectionsInDefaultFetchGroupEnabled )
? LazyAttributesMetadata.from( persistentClass, true, collectionsInDefaultFetchGroupEnabled )
: LazyAttributesMetadata.nonEnhanced( persistentClass.getEntityName() );
return new BytecodeEnhancementMetadataPojoImpl(

View File

@ -169,7 +169,6 @@ public class EntityMetamodel implements Serializable {
persistentClass,
idAttributeNames,
nonAggregatedCidMapper,
sessionFactoryOptions.isEnhancementAsProxyEnabled(),
sessionFactoryOptions.isCollectionsInDefaultFetchGroupEnabled()
);
}
@ -252,7 +251,6 @@ public class EntityMetamodel implements Serializable {
boolean lazy = ! EnhancementHelper.includeInBaseFetchGroup(
prop,
bytecodeEnhancementMetadata.isEnhancedForLazyLoading(),
sessionFactoryOptions.isEnhancementAsProxyEnabled(),
sessionFactoryOptions.isCollectionsInDefaultFetchGroupEnabled()
);

View File

@ -37,7 +37,6 @@ public class InstrumentedProxyLazyToOneTest extends BaseNonConfigCoreFunctionalT
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override

View File

@ -22,6 +22,7 @@ import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.bytecode.spi.BytecodeEnhancementMetadata;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -64,6 +65,10 @@ public class CascadeDeleteManyToOneTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void testManagedWithUninitializedAssociation() {
// Delete the Child
doInHibernate(
@ -109,6 +114,10 @@ public class CascadeDeleteManyToOneTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void testDetachedWithUninitializedAssociation() {
final Child detachedChild = doInHibernate(
this::sessionFactory, s -> {
@ -136,6 +145,10 @@ public class CascadeDeleteManyToOneTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void testDetachedWithInitializedAssociation() {
final Child detachedChild = doInHibernate(
this::sessionFactory, s -> {

View File

@ -19,6 +19,7 @@ import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
@ -54,6 +55,10 @@ public class CascadeOnUninitializedTest extends BaseNonConfigCoreFunctionalTestC
}
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void testMergeDetachedEnhancedEntityWithUninitializedManyToOne() {
Person person = persistPersonWithManyToOne();
@ -81,6 +86,10 @@ public class CascadeOnUninitializedTest extends BaseNonConfigCoreFunctionalTestC
}
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void testDeleteEnhancedEntityWithUninitializedManyToOne() {
Person person = persistPersonWithManyToOne();

View File

@ -26,6 +26,7 @@ import org.hibernate.bytecode.enhance.spi.UnloadedField;
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.bytecode.enhancement.CustomEnhancementContext;
@ -53,6 +54,10 @@ import static org.junit.Assert.assertTrue;
EnhancerTestContext.class, // supports laziness and dirty-checking
BidirectionalLazyTest.NoDirtyCheckEnhancementContext.class // supports laziness; does not support dirty-checking
})
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public class BidirectionalLazyTest extends BaseCoreFunctionalTestCase {
public Class<?>[] getAnnotatedClasses() {

View File

@ -6,17 +6,9 @@
*/
package org.hibernate.test.bytecode.enhancement.lazy;
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
@ -26,20 +18,30 @@ import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.engine.spi.PersistentAttributeInterceptable;
import org.hibernate.engine.spi.PersistentAttributeInterceptor;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hibernate.testing.bytecode.enhancement.EnhancerTestUtils.checkDirtyTracking;
import static org.hibernate.testing.bytecode.enhancement.EnhancerTestUtils.getFieldByReflection;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**
* @author Luis Barreiro
@ -82,13 +84,15 @@ public class LazyLoadingTest extends BaseCoreFunctionalTestCase {
public void test() {
doInHibernate( this::sessionFactory, s -> {
Child loadedChild = s.load( Child.class, lastChildID );
assertThat( loadedChild, not( instanceOf( HibernateProxy.class ) ) );
assertThat( loadedChild, instanceOf( PersistentAttributeInterceptable.class ) );
final PersistentAttributeInterceptable interceptable = (PersistentAttributeInterceptable) loadedChild;
final PersistentAttributeInterceptor interceptor = interceptable.$$_hibernate_getInterceptor();
assertThat( interceptor, instanceOf( EnhancementAsProxyLazinessInterceptor.class ) );
Object nameByReflection = getFieldByReflection( loadedChild, "name" );
assertNotNull( "Non-lazy field 'name' was not loaded", nameByReflection );
Object parentByReflection = getFieldByReflection( loadedChild, "parent" );
assertNull( "Lazy field 'parent' is initialized", parentByReflection );
assertFalse( loadedChild instanceof HibernateProxy );
assertThat( Hibernate.isPropertyInitialized( loadedChild, "name" ), is( false ) );
assertThat( Hibernate.isPropertyInitialized( loadedChild, "parent" ), is( false ) );
assertThat( Hibernate.isPropertyInitialized( loadedChild, "children" ), is( false ) );
Parent loadedParent = loadedChild.parent;
assertThat( loadedChild.name, notNullValue() );
@ -97,23 +101,18 @@ public class LazyLoadingTest extends BaseCoreFunctionalTestCase {
checkDirtyTracking( loadedChild );
parentByReflection = getFieldByReflection( loadedChild, "parent" );
Object childrenByReflection = getFieldByReflection( loadedParent, "children" );
assertNotNull( "Lazy field 'parent' is not loaded", parentByReflection );
assertNull( "Lazy field 'children' is initialized", childrenByReflection );
assertFalse( loadedParent instanceof HibernateProxy );
assertEquals( parentID, loadedParent.id );
assertThat( Hibernate.isPropertyInitialized( loadedChild, "name" ), is( true ) );
assertThat( Hibernate.isPropertyInitialized( loadedChild, "parent" ), is( true ) );
assertThat( Hibernate.isPropertyInitialized( loadedChild, "children" ), is( true ) );
Collection<Child> loadedChildren = loadedParent.children;
assertThat( Hibernate.isInitialized( loadedChildren ), is( false ) );
checkDirtyTracking( loadedChild );
checkDirtyTracking( loadedParent );
childrenByReflection = getFieldByReflection( loadedParent, "children" );
assertNotNull( "Lazy field 'children' is not loaded", childrenByReflection );
assertFalse( loadedChildren instanceof HibernateProxy );
assertEquals( CHILDREN_SIZE, loadedChildren.size() );
assertTrue( loadedChildren.contains( loadedChild ) );
loadedChildren.size();
assertThat( Hibernate.isInitialized( loadedChildren ), is( true ) );
} );
}

View File

@ -21,6 +21,7 @@ import org.hibernate.boot.SessionFactoryBuilder;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.bytecode.enhancement.EnhancementOptions;
@ -43,6 +44,10 @@ import static org.junit.Assert.assertFalse;
public class NaturalIdInUninitializedAssociationTest extends BaseNonConfigCoreFunctionalTestCase {
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void testImmutableNaturalId() {
inTransaction(
session -> {
@ -60,6 +65,10 @@ public class NaturalIdInUninitializedAssociationTest extends BaseNonConfigCoreFu
}
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void testMutableNaturalId() {
inTransaction(
session -> {

View File

@ -1,323 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.test.bytecode.enhancement.lazy;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.Hibernate;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.StatelessSession;
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.SessionFactoryBuilder;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.DB2Dialect;
import org.hibernate.query.Query;
import org.hibernate.stat.spi.StatisticsImplementor;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* @author Andrea Boriero
*/
@RunWith(BytecodeEnhancerRunner.class)
public class QueryScrollingWithInheritanceEagerManyToOneTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "false" );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {
super.configureSessionFactoryBuilder( sfb );
sfb.applyStatisticsSupport( true );
sfb.applySecondLevelCacheSupport( false );
sfb.applyQueryCacheSupport( false );
}
@Override
protected void applyMetadataSources(MetadataSources sources) {
super.applyMetadataSources( sources );
sources.addAnnotatedClass( EmployeeParent.class );
sources.addAnnotatedClass( Employee.class );
sources.addAnnotatedClass( OtherEntity.class );
}
@Test
public void testScrollableWithStatelessSession() {
final StatisticsImplementor stats = sessionFactory().getStatistics();
stats.clear();
ScrollableResults scrollableResults = null;
final StatelessSession statelessSession = sessionFactory().openStatelessSession();
try {
statelessSession.beginTransaction();
Query<Employee> query = statelessSession.createQuery(
"select distinct e from Employee e left join fetch e.otherEntities order by e.dept",
Employee.class
);
if ( getDialect() instanceof DB2Dialect ) {
/*
FetchingScrollableResultsImp#next() in order to check if the ResultSet is empty calls ResultSet#isBeforeFirst()
but the support for ResultSet#isBeforeFirst() is optional for ResultSets with a result
set type of TYPE_FORWARD_ONLY and db2 does not support it.
*/
scrollableResults = query.scroll( ScrollMode.SCROLL_INSENSITIVE );
}
else {
scrollableResults = query.scroll( ScrollMode.FORWARD_ONLY );
}
while ( scrollableResults.next() ) {
final Employee employee = (Employee) scrollableResults.get( 0 );
assertThat( Hibernate.isPropertyInitialized( employee, "otherEntities" ), is( true ) );
assertThat( Hibernate.isInitialized( employee.getOtherEntities() ), is( true ) );
if ( "ENG1".equals( employee.getDept() ) ) {
assertThat( employee.getOtherEntities().size(), is( 2 ) );
for ( OtherEntity otherEntity : employee.getOtherEntities() ) {
if ( "test1".equals( otherEntity.id ) ) {
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employee" ), is( false ) );
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employeeParent" ), is( true ) );
assertThat( otherEntity.employeeParent, is( employee ) );
}
else {
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employee" ), is( false ) );
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employeeParent" ), is( true ) );
assertThat( Hibernate.isInitialized( otherEntity.employeeParent ), is( true ) );
}
}
}
else {
assertThat( employee.getOtherEntities().size(), is( 0 ) );
}
}
statelessSession.getTransaction().commit();
assertThat( stats.getPrepareStatementCount(), is( 2L ) );
}
finally {
if ( scrollableResults != null ) {
scrollableResults.close();
}
if ( statelessSession.getTransaction().isActive() ) {
statelessSession.getTransaction().rollback();
}
statelessSession.close();
}
}
@Test
public void testScrollableWithSession() {
final StatisticsImplementor stats = sessionFactory().getStatistics();
stats.clear();
ScrollableResults scrollableResults = null;
final Session session = sessionFactory().openSession();
try {
session.beginTransaction();
Query<Employee> query = session.createQuery(
"select distinct e from Employee e left join fetch e.otherEntities order by e.dept",
Employee.class
);
if ( getDialect() instanceof DB2Dialect ) {
/*
FetchingScrollableResultsImp#next() in order to check if the ResultSet is empty calls ResultSet#isBeforeFirst()
but the support for ResultSet#isBeforeFirst() is optional for ResultSets with a result
set type of TYPE_FORWARD_ONLY and db2 does not support it.
*/
scrollableResults = query.scroll( ScrollMode.SCROLL_INSENSITIVE );
}
else {
scrollableResults = query.scroll( ScrollMode.FORWARD_ONLY );
}
while ( scrollableResults.next() ) {
final Employee employee = (Employee) scrollableResults.get( 0 );
assertThat( Hibernate.isPropertyInitialized( employee, "otherEntities" ), is( true ) );
assertThat( Hibernate.isInitialized( employee.getOtherEntities() ), is( true ) );
if ( "ENG1".equals( employee.getDept() ) ) {
assertThat( employee.getOtherEntities().size(), is( 2 ) );
for ( OtherEntity otherEntity : employee.getOtherEntities() ) {
if ( "test1".equals( otherEntity.id ) ) {
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employee" ), is( false ) );
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employeeParent" ), is( true ) );
assertThat( otherEntity.employeeParent, is( employee ) );
}
else {
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employee" ), is( false ) );
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employeeParent" ), is( true ) );
assertThat( Hibernate.isInitialized( otherEntity.employeeParent ), is( true ) );
}
}
}
else {
assertThat( employee.getOtherEntities().size(), is( 0 ) );
}
}
session.getTransaction().commit();
assertThat( stats.getPrepareStatementCount(), is( 2L ) );
}
finally {
if ( scrollableResults != null ) {
scrollableResults.close();
}
if ( session.getTransaction().isActive() ) {
session.getTransaction().rollback();
}
session.close();
}
}
@Before
public void prepareTestData() {
inTransaction(
session -> {
Employee e1 = new Employee( "ENG1" );
Employee e2 = new Employee( "ENG2" );
OtherEntity other1 = new OtherEntity( "test1" );
OtherEntity other2 = new OtherEntity( "test2" );
e1.getOtherEntities().add( other1 );
e1.getOtherEntities().add( other2 );
e1.getParentOtherEntities().add( other1 );
e1.getParentOtherEntities().add( other2 );
other1.employee = e1;
other2.employee = e1;
other1.employeeParent = e1;
other2.employeeParent = e2;
session.persist( other1 );
session.persist( other2 );
session.persist( e1 );
session.persist( e2 );
}
);
}
@After
public void cleanUpTestData() {
inTransaction(
session -> {
session.createQuery( "delete from OtherEntity" ).executeUpdate();
session.createQuery( "delete from Employee" ).executeUpdate();
session.createQuery( "delete from EmployeeParent" ).executeUpdate();
}
);
}
@Entity(name = "EmployeeParent")
@Table(name = "EmployeeParent")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public static abstract class EmployeeParent {
@Id
private String dept;
@OneToMany(targetEntity = OtherEntity.class, mappedBy = "employeeParent", fetch = FetchType.LAZY)
protected Set<OtherEntity> parentOtherEntities = new HashSet<>();
public Set<OtherEntity> getParentOtherEntities() {
if ( parentOtherEntities == null ) {
parentOtherEntities = new LinkedHashSet();
}
return parentOtherEntities;
}
public void setOtherEntities(Set<OtherEntity> pParentOtherEntites) {
parentOtherEntities = pParentOtherEntites;
}
public String getDept() {
return dept;
}
protected void setDept(String dept) {
this.dept = dept;
}
}
@Entity(name = "Employee")
@Table(name = "Employee")
public static class Employee extends EmployeeParent {
@OneToMany(targetEntity = OtherEntity.class, mappedBy = "employee", fetch = FetchType.LAZY)
protected Set<OtherEntity> otherEntities = new HashSet<>();
public Employee(String dept) {
this();
setDept( dept );
}
protected Employee() {
// this form used by Hibernate
}
public Set<OtherEntity> getOtherEntities() {
if ( otherEntities == null ) {
otherEntities = new LinkedHashSet();
}
return otherEntities;
}
public void setOtherEntities(Set<OtherEntity> pOtherEntites) {
otherEntities = pOtherEntites;
}
}
@Entity(name = "OtherEntity")
@Table(name = "OtherEntity")
public static class OtherEntity {
@Id
private String id;
@ManyToOne(fetch = FetchType.LAZY)
@LazyToOne(LazyToOneOption.NO_PROXY)
@JoinColumn(name = "Employee_Id")
protected Employee employee = null;
@ManyToOne(fetch = FetchType.EAGER)
//@LazyToOne(LazyToOneOption.NO_PROXY)
@JoinColumn(name = "EmployeeParent_Id")
protected EmployeeParent employeeParent = null;
protected OtherEntity() {
// this form used by Hibernate
}
public OtherEntity(String id) {
this.id = id;
}
public String getId() {
return id;
}
}
}

View File

@ -1,306 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.test.bytecode.enhancement.lazy;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.Hibernate;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.StatelessSession;
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.SessionFactoryBuilder;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.DB2Dialect;
import org.hibernate.query.Query;
import org.hibernate.stat.spi.StatisticsImplementor;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* @author Andrea Boriero
*/
@RunWith(BytecodeEnhancerRunner.class)
public class QueryScrollingWithInheritanceTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {
super.configureSessionFactoryBuilder( sfb );
sfb.applyStatisticsSupport( true );
sfb.applySecondLevelCacheSupport( false );
sfb.applyQueryCacheSupport( false );
}
@Override
protected void applyMetadataSources(MetadataSources sources) {
super.applyMetadataSources( sources );
sources.addAnnotatedClass( EmployeeParent.class );
sources.addAnnotatedClass( Employee.class );
sources.addAnnotatedClass( OtherEntity.class );
}
@Test
public void testScrollableWithStatelessSession() {
final StatisticsImplementor stats = sessionFactory().getStatistics();
stats.clear();
ScrollableResults scrollableResults = null;
final StatelessSession statelessSession = sessionFactory().openStatelessSession();
try {
statelessSession.beginTransaction();
Query<Employee> query = statelessSession.createQuery(
"select distinct e from Employee e left join fetch e.otherEntities order by e.dept",
Employee.class
);
if ( getDialect() instanceof DB2Dialect ) {
/*
FetchingScrollableResultsImp#next() in order to check if the ResultSet is empty calls ResultSet#isBeforeFirst()
but the support for ResultSet#isBeforeFirst() is optional for ResultSets with a result
set type of TYPE_FORWARD_ONLY and db2 does not support it.
*/
scrollableResults = query.scroll( ScrollMode.SCROLL_INSENSITIVE );
}
else {
scrollableResults = query.scroll( ScrollMode.FORWARD_ONLY );
}
while ( scrollableResults.next() ) {
final Employee employee = (Employee) scrollableResults.get( 0 );
assertThat( Hibernate.isPropertyInitialized( employee, "otherEntities" ), is( true ) );
assertThat( Hibernate.isInitialized( employee.getOtherEntities() ), is( true ) );
if ( "ENG1".equals( employee.getDept() ) ) {
assertThat( employee.getOtherEntities().size(), is( 2 ) );
for ( OtherEntity otherEntity : employee.getOtherEntities() ) {
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employee" ), is( false ) );
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employeeParent" ), is( false ) );
}
}
else {
assertThat( employee.getOtherEntities().size(), is( 0 ) );
}
}
statelessSession.getTransaction().commit();
assertThat( stats.getPrepareStatementCount(), is( 1L ) );
}
finally {
if ( scrollableResults != null ) {
scrollableResults.close();
}
if ( statelessSession.getTransaction().isActive() ) {
statelessSession.getTransaction().rollback();
}
statelessSession.close();
}
}
@Test
public void testScrollableWithSession() {
final StatisticsImplementor stats = sessionFactory().getStatistics();
stats.clear();
ScrollableResults scrollableResults = null;
final Session session = sessionFactory().openSession();
try {
session.beginTransaction();
Query<Employee> query = session.createQuery(
"select distinct e from Employee e left join fetch e.otherEntities order by e.dept",
Employee.class
);
if ( getDialect() instanceof DB2Dialect ) {
/*
FetchingScrollableResultsImp#next() in order to check if the ResultSet is empty calls ResultSet#isBeforeFirst()
but the support for ResultSet#isBeforeFirst() is optional for ResultSets with a result
set type of TYPE_FORWARD_ONLY and db2 does not support it.
*/
scrollableResults = query.scroll( ScrollMode.SCROLL_INSENSITIVE );
}
else {
scrollableResults = query.scroll( ScrollMode.FORWARD_ONLY );
}
while ( scrollableResults.next() ) {
final Employee employee = (Employee) scrollableResults.get( 0 );
assertThat( Hibernate.isPropertyInitialized( employee, "otherEntities" ), is( true ) );
assertThat( Hibernate.isInitialized( employee.getOtherEntities() ), is( true ) );
if ( "ENG1".equals( employee.getDept() ) ) {
assertThat( employee.getOtherEntities().size(), is( 2 ) );
for ( OtherEntity otherEntity : employee.getOtherEntities() ) {
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employee" ), is( false ) );
assertThat( Hibernate.isPropertyInitialized( otherEntity, "employeeParent" ), is( false ) );
}
}
else {
assertThat( employee.getOtherEntities().size(), is( 0 ) );
}
}
session.getTransaction().commit();
assertThat( stats.getPrepareStatementCount(), is( 1L ) );
}
finally {
if ( scrollableResults != null ) {
scrollableResults.close();
}
if ( session.getTransaction().isActive() ) {
session.getTransaction().rollback();
}
session.close();
}
}
@Before
public void prepareTestData() {
inTransaction(
session -> {
Employee e1 = new Employee( "ENG1" );
Employee e2 = new Employee( "ENG2" );
OtherEntity other1 = new OtherEntity( "test1" );
OtherEntity other2 = new OtherEntity( "test2" );
e1.getOtherEntities().add( other1 );
e1.getOtherEntities().add( other2 );
e1.getParentOtherEntities().add( other1 );
e1.getParentOtherEntities().add( other2 );
other1.employee = e1;
other2.employee = e1;
other1.employeeParent = e1;
other2.employeeParent = e2;
session.persist( other1 );
session.persist( other2 );
session.persist( e1 );
session.persist( e2 );
}
);
}
@After
public void cleanUpTestData() {
inTransaction(
session -> {
session.createQuery( "delete from OtherEntity" ).executeUpdate();
session.createQuery( "delete from Employee" ).executeUpdate();
session.createQuery( "delete from EmployeeParent" ).executeUpdate();
}
);
}
@Entity(name = "EmployeeParent")
@Table(name = "EmployeeParent")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public static abstract class EmployeeParent {
@Id
private String dept;
@OneToMany(targetEntity = OtherEntity.class, mappedBy = "employeeParent", fetch = FetchType.LAZY)
protected Set<OtherEntity> parentOtherEntities = new HashSet<>();
public Set<OtherEntity> getParentOtherEntities() {
if ( parentOtherEntities == null ) {
parentOtherEntities = new LinkedHashSet();
}
return parentOtherEntities;
}
public void setOtherEntities(Set<OtherEntity> pParentOtherEntites) {
parentOtherEntities = pParentOtherEntites;
}
public String getDept() {
return dept;
}
protected void setDept(String dept) {
this.dept = dept;
}
}
@Entity(name = "Employee")
@Table(name = "Employee")
public static class Employee extends EmployeeParent {
@OneToMany(targetEntity = OtherEntity.class, mappedBy = "employee", fetch = FetchType.LAZY)
protected Set<OtherEntity> otherEntities = new HashSet<>();
public Employee(String dept) {
this();
setDept( dept );
}
protected Employee() {
// this form used by Hibernate
}
public Set<OtherEntity> getOtherEntities() {
if ( otherEntities == null ) {
otherEntities = new LinkedHashSet();
}
return otherEntities;
}
public void setOtherEntities(Set<OtherEntity> pOtherEntites) {
otherEntities = pOtherEntites;
}
}
@Entity(name = "OtherEntity")
@Table(name = "OtherEntity")
public static class OtherEntity {
@Id
private String id;
@ManyToOne(fetch = FetchType.LAZY)
@LazyToOne(LazyToOneOption.NO_PROXY)
@JoinColumn(name = "Employee_Id")
protected Employee employee = null;
@ManyToOne(fetch = FetchType.LAZY)
@LazyToOne(LazyToOneOption.NO_PROXY)
@JoinColumn(name = "EmployeeParent_Id")
protected EmployeeParent employeeParent = null;
protected OtherEntity() {
// this form used by Hibernate
}
public OtherEntity(String id) {
this.id = id;
}
public String getId() {
return id;
}
}
}

View File

@ -174,12 +174,6 @@ public class StatelessQueryScrollingTest extends BaseNonConfigCoreFunctionalTest
);
}
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override
protected void applyMetadataSources(MetadataSources sources) {
super.applyMetadataSources( sources );

View File

@ -25,6 +25,7 @@ import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.stat.CacheRegionStatistics;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -52,6 +53,10 @@ public class UninitializedAssociationsInCacheTest extends BaseCoreFunctionalTest
@Test
@TestForIssue( jiraKey = "HHH-11766")
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void attributeLoadingFromCache() {
final AtomicLong bossId = new AtomicLong();
final AtomicLong teamleaderId = new AtomicLong();

View File

@ -23,6 +23,7 @@ import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.bytecode.enhance.spi.DefaultEnhancementContext;
import org.hibernate.bytecode.enhance.spi.UnloadedClass;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.bytecode.enhancement.CustomEnhancementContext;
@ -48,6 +49,10 @@ import static org.junit.Assert.assertTrue;
EnhancerTestContext.class,
BidirectionalLazyGroupsTest.NoDirtyCheckEnhancementContext.class
})
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public class BidirectionalLazyGroupsTest extends BaseCoreFunctionalTestCase {
public Class<?>[] getAnnotatedClasses() {

View File

@ -12,6 +12,8 @@ import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -45,6 +47,10 @@ import static org.junit.Assert.assertNull;
*/
@TestForIssue( jiraKey = "HHH-11155" )
@RunWith( BytecodeEnhancerRunner.class )
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public class LazyGroupTest extends BaseCoreFunctionalTestCase {
@Override

View File

@ -26,6 +26,7 @@ import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -50,6 +51,10 @@ public class LazyNotFoundManyToOneNonUpdatableNonInsertableTest extends BaseCore
}
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void test() {
doInHibernate(
this::sessionFactory, session -> {

View File

@ -15,8 +15,6 @@ import javax.persistence.ConstraintMode;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
@ -27,7 +25,10 @@ import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -37,6 +38,7 @@ import org.junit.runner.RunWith;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@TestForIssue( jiraKey = "HHH-12226")
@RunWith( BytecodeEnhancerRunner.class )
@ -51,7 +53,17 @@ public class LazyNotFoundOneToOneTest extends BaseCoreFunctionalTestCase {
};
}
@Override
protected void configure(Configuration configuration) {
super.configure(configuration);
configuration.setProperty( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void test() {
doInHibernate(
this::sessionFactory, session -> {

View File

@ -224,7 +224,6 @@ public class BatchFetchProxyTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
ssrb.applySetting( AvailableSettings.SHOW_SQL, true );

View File

@ -126,7 +126,6 @@ public class BidirectionalProxyTest extends BaseNonConfigCoreFunctionalTestCase
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -484,7 +484,6 @@ public class DeepInheritanceProxyTest extends BaseNonConfigCoreFunctionalTestCas
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -1288,7 +1288,6 @@ public class DeepInheritanceWithNonEntitiesProxyTest extends BaseNonConfigCoreFu
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -116,7 +116,6 @@ public class EntitySharedInCollectionAndToOneTest extends BaseNonConfigCoreFunct
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
}

View File

@ -509,7 +509,6 @@ public class FetchGraphTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
}

View File

@ -58,7 +58,6 @@ public class LazyCollectionDeletedAllowProxyTest extends BaseNonConfigCoreFuncti
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.USE_SECOND_LEVEL_CACHE, "false" );
ssrb.applySetting( AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS, "true" );
}

View File

@ -191,9 +191,6 @@ public class LazyGroupWithInheritanceAllowProxyTest extends BaseNonConfigCoreFun
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
// todo : this is the only difference between this test and LazyGroupWithInheritanceTest
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
ssrb.applySetting( AvailableSettings.USE_SECOND_LEVEL_CACHE, "false" );
ssrb.applySetting( AvailableSettings.USE_QUERY_CACHE, "false" );

View File

@ -15,6 +15,7 @@ import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.stat.Statistics;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.bytecode.enhancement.CustomEnhancementContext;
@ -38,6 +39,10 @@ import static org.junit.Assert.assertEquals;
@EnhancementOptions( lazyLoading = true )
public class LazyGroupWithInheritanceTest extends BaseNonConfigCoreFunctionalTestCase {
@Test
@FailureExpected(
jiraKey = "HHH-13658",
message = "Assertions specific to enhanced lazy loading but disallowing enhanced proxies, which is no longer valid"
)
public void queryEntityWithAssociationToAbstract() {
final Statistics stats = sessionFactory().getStatistics();
stats.clear();

View File

@ -57,12 +57,6 @@ import static org.junit.Assert.assertTrue;
@TestForIssue( jiraKey = "HHH-13640" )
@RunWith(BytecodeEnhancerRunner.class)
public class LazyToOnesNoProxyFactoryWithSubclassesStatefulTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {
super.configureSessionFactoryBuilder( sfb );

View File

@ -57,11 +57,6 @@ import static org.junit.Assert.assertTrue;
@TestForIssue( jiraKey = "HHH-13640" )
@RunWith(BytecodeEnhancerRunner.class)
public class LazyToOnesNoProxyFactoryWithSubclassesStatelessTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {

View File

@ -47,12 +47,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(BytecodeEnhancerRunner.class )
@EnhancementOptions(lazyLoading = true)
public class LazyToOnesProxyMergeWithSubclassesTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {
super.configureSessionFactoryBuilder( sfb );

View File

@ -43,11 +43,6 @@ import static org.junit.Assert.assertTrue;
@TestForIssue( jiraKey = "HHH-13640" )
@RunWith(BytecodeEnhancerRunner.class)
public class LazyToOnesProxyWithSubclassesStatelessTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {

View File

@ -43,11 +43,6 @@ import static org.junit.Assert.assertTrue;
@TestForIssue( jiraKey = "HHH-13640" )
@RunWith(BytecodeEnhancerRunner.class)
public class LazyToOnesProxyWithSubclassesTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {

View File

@ -159,7 +159,6 @@ public class LoadANonExistingEntityTest extends BaseNonConfigCoreFunctionalTestC
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -181,7 +181,6 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -161,7 +161,6 @@ public class LoadANonExistingNotFoundEntityTest extends BaseNonConfigCoreFunctio
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -41,7 +41,6 @@ public class MappedSuperclassWithEmbeddableTest extends BaseNonConfigCoreFunctio
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.USE_SECOND_LEVEL_CACHE, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );

View File

@ -132,7 +132,6 @@ public class MapsIdProxyBidirectionalTest extends BaseNonConfigCoreFunctionalTes
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
ssrb.applySetting( AvailableSettings.SHOW_SQL, true );

View File

@ -101,7 +101,6 @@ public class MapsIdProxyUnidirectionalTest extends BaseNonConfigCoreFunctionalTe
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
ssrb.applySetting( AvailableSettings.SHOW_SQL, true );

View File

@ -118,7 +118,6 @@ public class MergeDetachedToProxyTest extends BaseNonConfigCoreFunctionalTestCas
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -170,7 +170,6 @@ public class MergeProxyTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
}

View File

@ -74,7 +74,6 @@ public class NaturalIdInUninitializedProxyTest extends BaseNonConfigCoreFunction
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
}

View File

@ -54,7 +54,6 @@ public class ProxyDeletionTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
}

View File

@ -46,7 +46,6 @@ public class ProxyInitializeAndUpdateInlineDirtyTrackingDynamicUpdateTest extend
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override

View File

@ -36,11 +36,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(BytecodeEnhancerRunner.class)
@EnhancementOptions(lazyLoading = true,inlineDirtyChecking = true)
public class ProxyInitializeAndUpdateInlineDirtyTrackingTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {

View File

@ -37,11 +37,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(BytecodeEnhancerRunner.class)
@EnhancementOptions(lazyLoading = true)
public class ProxyInitializeAndUpdateTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {

View File

@ -49,11 +49,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
*/
@RunWith(BytecodeEnhancerRunner.class)
public class QueryScrollingWithInheritanceProxyEagerManyToOneTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
}
@Override
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) {

View File

@ -66,7 +66,6 @@ public class SetIdentifierOnAEnhancedProxyTest extends BaseNonConfigCoreFunction
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.USE_SECOND_LEVEL_CACHE, "false" );
ssrb.applySetting( AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS, "true" );

View File

@ -43,7 +43,6 @@ public class SharingReferenceTest extends BaseNonConfigCoreFunctionalTestCase {
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -61,7 +61,6 @@ public class SimpleUpdateTestWithLazyLoading extends BaseNonConfigCoreFunctional
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.USE_SECOND_LEVEL_CACHE, "false" );
ssrb.applySetting( AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS, "true" );

View File

@ -55,7 +55,6 @@ public class SimpleUpdateTestWithLazyLoadingAndInlineDirtyTracking extends BaseN
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.USE_SECOND_LEVEL_CACHE, "false" );
ssrb.applySetting( AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS, "true" );

View File

@ -46,7 +46,6 @@ public abstract class AbstractBatchingTest extends BaseNonConfigCoreFunctionalTe
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, "100" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -41,7 +41,6 @@ public class DirtyCheckPrivateUnMappedCollectionTest extends BaseNonConfigCoreFu
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, "100" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -44,7 +44,6 @@ public class EntityWithMutableAttributesTest extends BaseNonConfigCoreFunctional
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, "100" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -41,7 +41,6 @@ public class LoadAndUpdateEntitiesWithCollectionsTest extends BaseNonConfigCoreF
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, "100" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -63,7 +63,6 @@ public class ManyToOnePropertyAccessByFieldTest extends BaseNonConfigCoreFunctio
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -46,7 +46,6 @@ public class ManyToOneWithEmbeddedAndNotOptionalFieldTest extends BaseNonConfigC
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -43,7 +43,6 @@ public class SimpleDynamicUpdateTest extends BaseNonConfigCoreFunctionalTestCase
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, "100" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -44,7 +44,6 @@ public class DynamicUpdateAndCollectionsTest extends BaseNonConfigCoreFunctional
@Override
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) {
super.configureStandardServiceRegistryBuilder( ssrb );
ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
ssrb.applySetting( AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, "100" );
ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" );
}

View File

@ -43,7 +43,6 @@ public class EnhancedProxyCacheTest extends BaseCoreFunctionalTestCase {
@Override
protected void configure(Configuration cfg) {
super.configure( cfg );
cfg.setProperty( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" );
cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
cfg.setProperty( Environment.USE_SECOND_LEVEL_CACHE, "true" );
}