File tree 2 files changed +8
-1
lines changed
hibernate-core/src/main/java/org/hibernate
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ private void bindTargetManyToOne(
210
210
final KeyValue targetEntityIdentifier = targetEntity .getIdentifier ();
211
211
boolean referenceToPrimaryKey = mappedBy == null
212
212
|| targetEntityIdentifier instanceof Component
213
- && ( (Component ) targetEntityIdentifier ).hasProperty ( mappedBy );
213
+ && ( (Component ) targetEntityIdentifier ).matchesAllProperties ( mappedBy );
214
214
oneToOne .setReferenceToPrimaryKey ( referenceToPrimaryKey );
215
215
216
216
final String propertyRef = oneToOne .getReferencedPropertyName ();
Original file line number Diff line number Diff line change @@ -506,6 +506,13 @@ public Property getProperty(String propertyName) throws MappingException {
506
506
throw new MappingException ("component: " + componentClassName + " property not found: " + propertyName );
507
507
}
508
508
509
+ public boolean matchesAllProperties (String ... propertyNames ) {
510
+ return properties .size () == propertyNames .length &&
511
+ new HashSet <>(properties .stream ().map (Property ::getName )
512
+ .collect (toList ()))
513
+ .containsAll (List .of (propertyNames ));
514
+ }
515
+
509
516
public boolean hasProperty (String propertyName ) {
510
517
for ( Property prop : properties ) {
511
518
if ( prop .getName ().equals (propertyName ) ) {
You can’t perform that action at this time.
0 commit comments