Skip to content

Commit bc16d6e

Browse files
committed
[#1979] Fix find with EmbeddedId
When using the find with multiple embedded ids, only the first result was returned.
1 parent 3d08e03 commit bc16d6e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/sql/results/graph/embeddable/internal/ReactiveEmbeddableInitializerImpl.java

+9
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ public CompletionStage<Void> forEachReactiveSubInitializer(
8484
}
8585
}
8686

87+
@Override
88+
public void resolveInstance(EmbeddableInitializerData data) {
89+
// We need to clean up the instance, otherwise the .find with multiple id is not going to work correctly.
90+
// It will only return the first element of the list. See EmbeddedIdTest#testFindMultipleIds.
91+
// ORM doesn't have this issue because they don't have a find with multiple ids.
92+
data.setInstance( null );
93+
super.resolveInstance( data );
94+
}
95+
8796
@Override
8897
public Object getResolvedInstance(EmbeddableInitializerData data) {
8998
return super.getResolvedInstance( data );

0 commit comments

Comments
 (0)