From c68ac20c248491f444ede841133f8177e6c43283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 2 May 2023 13:12:26 +0200 Subject: [PATCH] HSEARCH-4848 Fix unpredictable order of some associations in automatic reindexing tests --- .../onetomany/AutomaticIndexingOneToManyCollectionBaseIT.java | 2 ++ .../bytype/onetomany/AutomaticIndexingOneToManyListBaseIT.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetomany/AutomaticIndexingOneToManyCollectionBaseIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetomany/AutomaticIndexingOneToManyCollectionBaseIT.java index 94521c384da..c5b83fbde87 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetomany/AutomaticIndexingOneToManyCollectionBaseIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetomany/AutomaticIndexingOneToManyCollectionBaseIT.java @@ -160,6 +160,7 @@ public static class ContainingEntity { * TODO use mappedBy when the above gets fixed in Hibernate ORM */ @OneToMany + @OrderColumn(name = "idx") @JoinTable(name = "i_containedECAssocIdxEmb", joinColumns = @JoinColumn(name = "containing"), inverseJoinColumns = @JoinColumn(name = "contained")) @@ -175,6 +176,7 @@ public static class ContainingEntity { * TODO use mappedBy when the above gets fixed in Hibernate ORM */ @OneToMany + @OrderColumn(name = "idx") @JoinTable(name = "i_containedECAssocNonIdxEmb", joinColumns = @JoinColumn(name = "containing"), inverseJoinColumns = @JoinColumn(name = "contained")) diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetomany/AutomaticIndexingOneToManyListBaseIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetomany/AutomaticIndexingOneToManyListBaseIT.java index e246830ffd8..435cd3259e9 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetomany/AutomaticIndexingOneToManyListBaseIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/automaticindexing/association/bytype/onetomany/AutomaticIndexingOneToManyListBaseIT.java @@ -397,10 +397,12 @@ public PropertyAccessor nonIndexedField() { public static class ContainingEmbeddable { @OneToMany(mappedBy = "embeddedAssociations.containingAsIndexedEmbedded") + @OrderBy("id asc") // Make sure the iteration order is predictable @IndexedEmbedded(includePaths = { "indexedField", "indexedElementCollectionField", "containedDerivedField" }) private List containedIndexedEmbedded = new ArrayList<>(); @OneToMany(mappedBy = "embeddedAssociations.containingAsNonIndexedEmbedded") + @OrderBy("id asc") // Make sure the iteration order is predictable private List containedNonIndexedEmbedded = new ArrayList<>(); public List getContainedIndexedEmbedded() {