diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/AbstractAutomaticIndexingAssociationBaseIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/AbstractAutomaticIndexingAssociationBaseIT.java index d45e2e7e868..f48b9b12915 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/AbstractAutomaticIndexingAssociationBaseIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/AbstractAutomaticIndexingAssociationBaseIT.java @@ -207,10 +207,6 @@ public AbstractAutomaticIndexingAssociationBaseIT(IndexedEntityPrimitives bWith - .objectField( "embeddedAssociations", b2 -> b2 - .objectField( "containedIndexedEmbedded", - associationFieldContributor.andThen( b3 -> b3 - .field( "indexedField", String.class ) - .field( "indexedElementCollectionField", String.class, b4 -> b4.multiValued( true ) ) - .field( "containedDerivedField", String.class ) - ) - ) - ) - : bWith -> { } ) + .objectField( "embeddedAssociations", b2 -> b2 + .objectField( "containedIndexedEmbedded", + associationFieldContributor.andThen( b3 -> b3 + .field( "indexedField", String.class ) + .field( "indexedElementCollectionField", String.class, b4 -> b4.multiValued( true ) ) + .field( "containedDerivedField", String.class ) + ) + ) + ) .with( isElementCollectionAssociationsOnContainingSide() ? bWith -> bWith .objectField( "elementCollectionAssociations", b2 -> b2 .multiValued( true ) @@ -353,17 +347,15 @@ public void setup(OrmSetupHelper.SetupContext setupContext, ReusableOrmSetupHold .field( "indexedField", String.class ) ) ) - .with( includeEmbeddedAssociationsInSchema() ? bWith -> bWith - .objectField( "embeddedAssociations", b2 -> b2 - .objectField( "containedIndexedEmbedded", - associationFieldContributor.andThen( b3 -> b3 - .field( "indexedField", String.class ) - .field( "indexedElementCollectionField", String.class, b4 -> b4.multiValued( true ) ) - .field( "containedDerivedField", String.class ) - ) + .objectField( "embeddedAssociations", b2 -> b2 + .objectField( "containedIndexedEmbedded", + associationFieldContributor.andThen( b3 -> b3 + .field( "indexedField", String.class ) + .field( "indexedElementCollectionField", String.class, b4 -> b4.multiValued( true ) ) + .field( "containedDerivedField", String.class ) ) ) - : bWith -> { } ) + ) .with( isElementCollectionAssociationsOnContainingSide() ? bWith -> bWith .objectField( "elementCollectionAssociations", b2 -> b2 .multiValued( true ) diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetoone/ownedbycontained/AutomaticIndexingOneToOneOwnedByContainedLazyOnContainingSideIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetoone/ownedbycontained/AutomaticIndexingOneToOneOwnedByContainedLazyOnContainingSideIT.java index ea90597d52c..2a43f25e1c3 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetoone/ownedbycontained/AutomaticIndexingOneToOneOwnedByContainedLazyOnContainingSideIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetoone/ownedbycontained/AutomaticIndexingOneToOneOwnedByContainedLazyOnContainingSideIT.java @@ -7,7 +7,6 @@ package org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.onetoone.ownedbycontained; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assume.assumeTrue; import java.lang.reflect.Method; import java.util.ArrayList; @@ -86,57 +85,6 @@ protected boolean isAssociationLazyOnContainingSide() { return true; } - @Override - protected boolean includeEmbeddedAssociationsInSchema() { - // See https://hibernate.atlassian.net/browse/HHH-15606 - return false; - } - - @Override - public void directAssociationUpdate_embeddedAssociationsIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void directAssociationUpdate_embeddedAssociationsNonIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void directEmbeddedAssociationReplace_embeddedAssociationsIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void directEmbeddedAssociationReplace_embeddedAssociationsNonIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void indirectAssociationUpdate_embeddedAssociationsIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void indirectAssociationUpdate_embeddedAssociationsNonIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void indirectEmbeddedAssociationReplace_embeddedAssociationsIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void indirectEmbeddedAssociationReplace_embeddedAssociationsNonIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - private void notTestedBecauseOfHHH15606() { - assumeTrue( "This test is disabled because of https://hibernate.atlassian.net/browse/HHH-15606", - false ); - } - @Override public void setup(OrmSetupHelper.SetupContext setupContext, ReusableOrmSetupHolder.DataClearConfig dataClearConfig) { @@ -182,6 +130,9 @@ public static class ContainingEntity { "containedIndexedEmbeddedNoReindexOnUpdate.indexedElementCollectionField", "containedIndexedEmbeddedNoReindexOnUpdate.containedDerivedField", "containedIndexedEmbeddedWithCast.indexedField", + "embeddedAssociations.containedIndexedEmbedded.indexedField", + "embeddedAssociations.containedIndexedEmbedded.indexedElementCollectionField", + "embeddedAssociations.containedIndexedEmbedded.containedDerivedField", "containedElementCollectionAssociationsIndexedEmbedded.indexedField", "containedElementCollectionAssociationsIndexedEmbedded.indexedElementCollectionField", "containedElementCollectionAssociationsIndexedEmbedded.containedDerivedField", @@ -213,6 +164,10 @@ public static class ContainingEntity { @IndexedEmbedded(includePaths = { "indexedField" }, targetType = ContainedEntity.class) private Object containedIndexedEmbeddedWithCast; + @IndexedEmbedded + @Embedded + private ContainingEmbeddable embeddedAssociations; + /* * No mappedBy here. The inverse side of associations within an element collection cannot use mappedBy. * If they do, Hibernate ORM will fail (throw an exception) while attempting to walk down the mappedBy path, @@ -324,6 +279,14 @@ public void setContainedIndexedEmbeddedWithCast(Object containedIndexedEmbeddedW this.containedIndexedEmbeddedWithCast = containedIndexedEmbeddedWithCast; } + public ContainingEmbeddable getEmbeddedAssociations() { + return embeddedAssociations; + } + + public void setEmbeddedAssociations(ContainingEmbeddable embeddedAssociations) { + this.embeddedAssociations = embeddedAssociations; + } + public ContainedEntity getContainedElementCollectionAssociationsIndexedEmbedded() { return containedElementCollectionAssociationsIndexedEmbedded; } @@ -424,8 +387,7 @@ public PropertyAccessor containedIndexedEmbed @Override public PropertyAccessor embeddedAssociations() { - // See https://hibernate.atlassian.net/browse/HHH-15606 - throw primitiveNotSupported(); + return PropertyAccessor.create( ContainingEntity::setEmbeddedAssociations, ContainingEntity::getEmbeddedAssociations ); } @Override @@ -552,6 +514,9 @@ public static class ContainedEntity { @JoinColumn(name = "CIndexedEmbeddedCast") private Object containingAsIndexedEmbeddedWithCast; + @Embedded + private ContainedEmbeddable embeddedAssociations; + @ElementCollection @Embedded @OrderColumn(name = "idx") @@ -656,6 +621,14 @@ public void setContainingAsIndexedEmbeddedWithCast(Object containingAsIndexedEmb this.containingAsIndexedEmbeddedWithCast = containingAsIndexedEmbeddedWithCast; } + public ContainedEmbeddable getEmbeddedAssociations() { + return embeddedAssociations; + } + + public void setEmbeddedAssociations(ContainedEmbeddable embeddedAssociations) { + this.embeddedAssociations = embeddedAssociations; + } + public List getElementCollectionAssociations() { return elementCollectionAssociations; } @@ -784,8 +757,7 @@ public PropertyAccessor containingAsIndexedEm @Override public PropertyAccessor embeddedAssociations() { - // See https://hibernate.atlassian.net/browse/HHH-15606 - throw primitiveNotSupported(); + return PropertyAccessor.create( ContainedEntity::setEmbeddedAssociations, ContainedEntity::getEmbeddedAssociations ); } @Override diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetoone/ownedbycontaining/AutomaticIndexingOneToOneOwnedByContainingLazyOnContainedSideIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetoone/ownedbycontaining/AutomaticIndexingOneToOneOwnedByContainingLazyOnContainedSideIT.java index 3d427bc5783..4109ed9ed8f 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetoone/ownedbycontaining/AutomaticIndexingOneToOneOwnedByContainingLazyOnContainedSideIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetoone/ownedbycontaining/AutomaticIndexingOneToOneOwnedByContainingLazyOnContainedSideIT.java @@ -7,7 +7,6 @@ package org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.onetoone.ownedbycontaining; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assume.assumeTrue; import java.lang.reflect.Method; import java.util.ArrayList; @@ -85,57 +84,6 @@ protected boolean isAssociationLazyOnContainingSide() { return false; } - @Override - protected boolean includeEmbeddedAssociationsInSchema() { - // See https://hibernate.atlassian.net/browse/HHH-15606 - return false; - } - - @Override - public void directAssociationUpdate_embeddedAssociationsIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void directAssociationUpdate_embeddedAssociationsNonIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void directEmbeddedAssociationReplace_embeddedAssociationsIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void directEmbeddedAssociationReplace_embeddedAssociationsNonIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void indirectAssociationUpdate_embeddedAssociationsIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void indirectAssociationUpdate_embeddedAssociationsNonIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void indirectEmbeddedAssociationReplace_embeddedAssociationsIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - @Override - public void indirectEmbeddedAssociationReplace_embeddedAssociationsNonIndexedEmbedded() { - notTestedBecauseOfHHH15606(); - } - - private void notTestedBecauseOfHHH15606() { - assumeTrue( "This test is disabled because of https://hibernate.atlassian.net/browse/HHH-15606", - false ); - } - @Override public void setup(OrmSetupHelper.SetupContext setupContext, ReusableOrmSetupHolder.DataClearConfig dataClearConfig) { @@ -182,6 +130,9 @@ public static class ContainingEntity { "containedIndexedEmbeddedNoReindexOnUpdate.indexedElementCollectionField", "containedIndexedEmbeddedNoReindexOnUpdate.containedDerivedField", "containedIndexedEmbeddedWithCast.indexedField", + "embeddedAssociations.containedIndexedEmbedded.indexedField", + "embeddedAssociations.containedIndexedEmbedded.indexedElementCollectionField", + "embeddedAssociations.containedIndexedEmbedded.containedDerivedField", "elementCollectionAssociations.containedIndexedEmbedded.indexedField", "elementCollectionAssociations.containedIndexedEmbedded.indexedElementCollectionField", "elementCollectionAssociations.containedIndexedEmbedded.containedDerivedField", @@ -217,6 +168,10 @@ public static class ContainingEntity { @IndexedEmbedded(includePaths = { "indexedField" }, targetType = ContainedEntity.class) private Object containedIndexedEmbeddedWithCast; + @IndexedEmbedded + @Embedded + private ContainingEmbeddable embeddedAssociations; + @IndexedEmbedded @ElementCollection @Embedded @@ -307,6 +262,14 @@ public void setContainedIndexedEmbeddedWithCast(Object containedIndexedEmbeddedW this.containedIndexedEmbeddedWithCast = containedIndexedEmbeddedWithCast; } + public ContainingEmbeddable getEmbeddedAssociations() { + return embeddedAssociations; + } + + public void setEmbeddedAssociations(ContainingEmbeddable embeddedAssociations) { + this.embeddedAssociations = embeddedAssociations; + } + public List getElementCollectionAssociations() { return elementCollectionAssociations; } @@ -393,7 +356,7 @@ public PropertyAccessor containedIndexedEmbed @Override public PropertyAccessor embeddedAssociations() { - throw primitiveNotSupported(); + return PropertyAccessor.create( ContainingEntity::setEmbeddedAssociations, ContainingEntity::getEmbeddedAssociations ); } @Override @@ -510,6 +473,9 @@ public static class ContainedEntity { @OneToOne(mappedBy = "containedIndexedEmbeddedWithCast", targetEntity = ContainingEntity.class, fetch = FetchType.LAZY) private Object containingAsIndexedEmbeddedWithCast; + @Embedded + private ContainedEmbeddable embeddedAssociations; + /* * No mappedBy here. The inverse side of associations within an element collection cannot use mappedBy. * If they do, Hibernate ORM will fail (throw an exception) while attempting to walk down the mappedBy path, @@ -635,6 +601,14 @@ public void setContainingAsIndexedEmbeddedWithCast(Object containingAsIndexedEmb this.containingAsIndexedEmbeddedWithCast = containingAsIndexedEmbeddedWithCast; } + public ContainedEmbeddable getEmbeddedAssociations() { + return embeddedAssociations; + } + + public void setEmbeddedAssociations(ContainedEmbeddable embeddedAssociations) { + this.embeddedAssociations = embeddedAssociations; + } + public ContainingEntity getContainingAsElementCollectionAssociationsIndexedEmbedded() { return containingAsElementCollectionAssociationsIndexedEmbedded; } @@ -777,7 +751,7 @@ public PropertyAccessor containingAsIndexedEm @Override public PropertyAccessor embeddedAssociations() { - throw primitiveNotSupported(); + return PropertyAccessor.create( ContainedEntity::setEmbeddedAssociations, ContainedEntity::getEmbeddedAssociations ); } @Override