Skip to content

Commit

Permalink
HSEARCH-4783 Fix extensive joins in tests hitting the 61-table limit …
Browse files Browse the repository at this point in the history
…on MariaDB/MySQL
  • Loading branch information
yrodiere committed Jan 27, 2023
1 parent b272e40 commit 96d880f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void setup(OrmSetupHelper.SetupContext setupContext,
// Avoid problems with deep chains of eager associations in ORM 6
// See https://github.com/hibernate/hibernate-orm/blob/main/migration-guide.adoc#fetch-behaviour-change
// See https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/lazy.20associations.20with.20ORM.206
setupContext.withProperty( AvailableSettings.MAX_FETCH_DEPTH, 2 );
setupContext.withProperty( AvailableSettings.MAX_FETCH_DEPTH, 1 );

// We're simulating a mappedBy with two associations (see comments in annotation mapping),
// so we need to clear one side before we can delete entities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import javax.persistence.OrderColumn;
import javax.persistence.Transient;

import org.hibernate.cfg.AvailableSettings;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.AbstractAutomaticIndexingSingleValuedAssociationBaseIT;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.ContainerPrimitives;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.accessor.MultiValuedPropertyAccessor;
Expand Down Expand Up @@ -89,6 +90,11 @@ protected boolean isAssociationLazyOnContainingSide() {
public void setup(OrmSetupHelper.SetupContext setupContext,
ReusableOrmSetupHolder.DataClearConfig dataClearConfig) {
super.setup( setupContext, dataClearConfig );
// Avoid problems with deep chains of eager associations in ORM 6
// See https://github.com/hibernate/hibernate-orm/blob/main/migration-guide.adoc#fetch-behaviour-change
// See https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/lazy.20associations.20with.20ORM.206
setupContext.withProperty( AvailableSettings.MAX_FETCH_DEPTH, 1 );

// Necessary for BytecodeEnhancerRunner, see BytecodeEnhancementIT.setup
setupContext.withTcclLookupPrecedenceBefore();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import javax.persistence.OrderColumn;
import javax.persistence.Transient;

import org.hibernate.cfg.AvailableSettings;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.AbstractAutomaticIndexingSingleValuedAssociationBaseIT;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.ContainerPrimitives;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.accessor.MultiValuedPropertyAccessor;
Expand Down Expand Up @@ -89,6 +90,11 @@ protected boolean isAssociationLazyOnContainingSide() {
public void setup(OrmSetupHelper.SetupContext setupContext,
ReusableOrmSetupHolder.DataClearConfig dataClearConfig) {
super.setup( setupContext, dataClearConfig );
// Avoid problems with deep chains of eager associations in ORM 6
// See https://github.com/hibernate/hibernate-orm/blob/main/migration-guide.adoc#fetch-behaviour-change
// See https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/lazy.20associations.20with.20ORM.206
setupContext.withProperty( AvailableSettings.MAX_FETCH_DEPTH, 1 );

// Necessary for BytecodeEnhancerRunner, see BytecodeEnhancementIT.setup
setupContext.withTcclLookupPrecedenceBefore();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void setup(OrmSetupHelper.SetupContext setupContext,
// Avoid problems with deep chains of eager associations in ORM 6
// See https://github.com/hibernate/hibernate-orm/blob/main/migration-guide.adoc#fetch-behaviour-change
// See https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/lazy.20associations.20with.20ORM.206
setupContext.withProperty( AvailableSettings.MAX_FETCH_DEPTH, 2 );
setupContext.withProperty( AvailableSettings.MAX_FETCH_DEPTH, 1 );

// We're simulating a mappedBy with two associations (see comments in annotation mapping),
// so we need to clear one side before we can delete entities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.persistence.OrderColumn;
import javax.persistence.Transient;

import org.hibernate.cfg.AvailableSettings;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.AbstractAutomaticIndexingSingleValuedAssociationBaseIT;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.ContainerPrimitives;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.accessor.MultiValuedPropertyAccessor;
Expand Down Expand Up @@ -88,6 +89,10 @@ protected boolean isAssociationLazyOnContainingSide() {
public void setup(OrmSetupHelper.SetupContext setupContext,
ReusableOrmSetupHolder.DataClearConfig dataClearConfig) {
super.setup( setupContext, dataClearConfig );
// Avoid problems with deep chains of eager associations in ORM 6
// See https://github.com/hibernate/hibernate-orm/blob/main/migration-guide.adoc#fetch-behaviour-change
// See https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/lazy.20associations.20with.20ORM.206
setupContext.withProperty( AvailableSettings.MAX_FETCH_DEPTH, 1 );

// Necessary for BytecodeEnhancerRunner, see BytecodeEnhancementIT.setup
setupContext.withTcclLookupPrecedenceBefore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.persistence.OrderColumn;
import javax.persistence.Transient;

import org.hibernate.cfg.AvailableSettings;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.AbstractAutomaticIndexingSingleValuedAssociationBaseIT;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.ContainerPrimitives;
import org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.accessor.MultiValuedPropertyAccessor;
Expand Down Expand Up @@ -88,6 +89,10 @@ protected boolean isAssociationLazyOnContainingSide() {
public void setup(OrmSetupHelper.SetupContext setupContext,
ReusableOrmSetupHolder.DataClearConfig dataClearConfig) {
super.setup( setupContext, dataClearConfig );
// Avoid problems with deep chains of eager associations in ORM 6
// See https://github.com/hibernate/hibernate-orm/blob/main/migration-guide.adoc#fetch-behaviour-change
// See https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/lazy.20associations.20with.20ORM.206
setupContext.withProperty( AvailableSettings.MAX_FETCH_DEPTH, 1 );

// Necessary for BytecodeEnhancerRunner, see BytecodeEnhancementIT.setup
setupContext.withTcclLookupPrecedenceBefore();
Expand Down

0 comments on commit 96d880f

Please sign in to comment.