diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java index 0e845731d3..0f5f503fb4 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java @@ -120,13 +120,15 @@ public class RootEntitySourceImpl extends AbstractEntitySourceImpl implements Ro public List attributeSources() { List attributeSources = new ArrayList(); final JaxbHibernateMapping.JaxbClass.JaxbNaturalId naturalId = entityElement().getNaturalId(); - processAttributes( - attributeSources, - naturalId.getPropertyOrManyToOneOrComponent(), - naturalId.isMutable() - ? SingularAttributeSource.NaturalIdMutability.MUTABLE - : SingularAttributeSource.NaturalIdMutability.IMMUTABLE - ); + if ( naturalId != null ) { + processAttributes( + attributeSources, + naturalId.getPropertyOrManyToOneOrComponent(), + naturalId.isMutable() + ? SingularAttributeSource.NaturalIdMutability.MUTABLE + : SingularAttributeSource.NaturalIdMutability.IMMUTABLE + ); + } processAttributes( attributeSources ); return attributeSources; }