Skip to content

Commit 347398a

Browse files
committed
HHH-7450 fix test failure
1 parent f057bc8 commit 347398a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,14 @@ else if ( entityElement().getTimestamp() != null ) {
141141
protected List<AttributeSource> buildAttributeSources(List<AttributeSource> attributeSources) {
142142
final JaxbNaturalIdElement naturalId = entityElement().getNaturalId();
143143
if ( naturalId != null ) {
144-
return buildAttributeSources(
145-
entityElement(), attributeSources, null, naturalId.isMutable()
146-
? SingularAttributeBinding.NaturalIdMutability.MUTABLE
147-
: SingularAttributeBinding.NaturalIdMutability.IMMUTABLE
148-
);
149-
}
150-
else {
151-
return super.buildAttributeSources( attributeSources );
152-
}
144+
final SingularAttributeBinding.NaturalIdMutability naturalIdMutability = naturalId.isMutable() ? SingularAttributeBinding.NaturalIdMutability.MUTABLE : SingularAttributeBinding.NaturalIdMutability.IMMUTABLE;
145+
processPropertyAttributes( attributeSources, naturalId.getProperty(), null, naturalIdMutability );
146+
processManyToOneAttributes( attributeSources, naturalId.getManyToOne(), null, naturalIdMutability );
147+
processComponentAttributes( attributeSources, naturalId.getComponent(), null, naturalIdMutability );
148+
processDynamicComponentAttributes( attributeSources, naturalId.getDynamicComponent(), null, naturalIdMutability );
149+
processAnyAttributes( attributeSources, naturalId.getAny(), null, naturalIdMutability );
150+
}
151+
return super.buildAttributeSources( attributeSources );
153152
}
154153

155154
@Override

hibernate-core/src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ arbitrary number of queries, and import declarations of arbitrary classes.
321321
<xs:complexType name="natural-id-element">
322322
<xs:sequence>
323323
<xs:choice minOccurs="0" maxOccurs="unbounded">
324+
<xs:annotation>
325+
<xs:appinfo>
326+
<simplify:as-element-property/>
327+
</xs:appinfo>
328+
</xs:annotation>
324329
<xs:element name="property" type="property-element"/>
325330
<xs:element name="many-to-one" type="many-to-one-element"/>
326331
<xs:element name="component" type="component-element"/>

0 commit comments

Comments
 (0)