Skip to content

Commit

Permalink
HSEARCH-4848 Fix unpredictable order of some associations in automati…
Browse files Browse the repository at this point in the history
…c reindexing tests
  • Loading branch information
yrodiere committed May 2, 2023
1 parent 0b1eedd commit c68ac20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,12 @@ public PropertyAccessor<ContainingEntity, String> 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<ContainedEntity> containedIndexedEmbedded = new ArrayList<>();

@OneToMany(mappedBy = "embeddedAssociations.containingAsNonIndexedEmbedded")
@OrderBy("id asc") // Make sure the iteration order is predictable
private List<ContainedEntity> containedNonIndexedEmbedded = new ArrayList<>();

public List<ContainedEntity> getContainedIndexedEmbedded() {
Expand Down

0 comments on commit c68ac20

Please sign in to comment.