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 31, 2023
1 parent c48bd3e commit d3541ff
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
Expand Up @@ -80,9 +80,9 @@ 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://github.com/hibernate/hibernate-orm/blob/6.0/migration-guide.adoc#fetch-circularity-determination
// 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
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/6.0/migration-guide.adoc#fetch-circularity-determination
// 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
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/6.0/migration-guide.adoc#fetch-circularity-determination
// 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
Expand Up @@ -79,9 +79,9 @@ 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://github.com/hibernate/hibernate-orm/blob/6.0/migration-guide.adoc#fetch-circularity-determination
// 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
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/6.0/migration-guide.adoc#fetch-circularity-determination
// 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
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/6.0/migration-guide.adoc#fetch-circularity-determination
// 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 d3541ff

Please sign in to comment.