HHH-15784 Fix primitive array as NaturalId.

This commit is contained in:
Georg Echterling 2022-11-30 11:50:06 +01:00 committed by Andrea Boriero
parent f13c69fb63
commit 81d9707f61
1 changed files with 3 additions and 2 deletions

View File

@ -114,7 +114,8 @@ public class SimpleNaturalIdMapping extends AbstractNaturalIdMapping implements
return;
}
if ( naturalIdValue.getClass().isArray() ) {
final Class<?> naturalIdValueClass = naturalIdValue.getClass();
if ( naturalIdValueClass.isArray() && !naturalIdValueClass.getComponentType().isPrimitive() ) {
// be flexible
final Object[] values = (Object[]) naturalIdValue;
if ( values.length == 1 ) {
@ -128,7 +129,7 @@ public class SimpleNaturalIdMapping extends AbstractNaturalIdMapping implements
Locale.ROOT,
"Incoming natural-id value [%s (`%s`)] is not of expected type [`%s`] and could not be coerced",
naturalIdValue,
naturalIdValue.getClass().getName(),
naturalIdValueClass.getName(),
getJavaType().getJavaType().getTypeName()
)
);