From a90aaa48b40dffe223c7daf5b167884d605ac1b7 Mon Sep 17 00:00:00 2001 From: gbadner Date: Thu, 25 Feb 2021 08:55:45 -0800 Subject: [PATCH] HHH-14467 Avoid false positives when detecting *ToOne associations that are part of the identifier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yoann Rodière --- .../src/main/java/org/hibernate/cfg/ToOneFkSecondPass.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/ToOneFkSecondPass.java b/hibernate-core/src/main/java/org/hibernate/cfg/ToOneFkSecondPass.java index e849bd6200..b04c27d16e 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/ToOneFkSecondPass.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/ToOneFkSecondPass.java @@ -79,7 +79,7 @@ public class ToOneFkSecondPass extends FkSecondPass { Iterator it = ( (Component) valueIdentifier ).getPropertyIterator(); while ( it.hasNext() ) { Property idProperty = (Property) it.next(); - if ( localPath.startsWith( idProperty.getName() ) ) { + if ( localPath.equals( idProperty.getName() ) || localPath.startsWith( idProperty.getName() + "." ) ) { return true; } }