HHH-7450 fix test failure

This commit is contained in:
Strong Liu 2012-07-16 19:16:21 +08:00
parent f057bc8ac9
commit 347398aad5
2 changed files with 12 additions and 8 deletions

View File

@ -141,15 +141,14 @@ public class RootEntitySourceImpl extends AbstractEntitySourceImpl implements Ro
protected List<AttributeSource> buildAttributeSources(List<AttributeSource> attributeSources) {
final JaxbNaturalIdElement naturalId = entityElement().getNaturalId();
if ( naturalId != null ) {
return buildAttributeSources(
entityElement(), attributeSources, null, naturalId.isMutable()
? SingularAttributeBinding.NaturalIdMutability.MUTABLE
: SingularAttributeBinding.NaturalIdMutability.IMMUTABLE
);
}
else {
return super.buildAttributeSources( attributeSources );
final SingularAttributeBinding.NaturalIdMutability naturalIdMutability = naturalId.isMutable() ? SingularAttributeBinding.NaturalIdMutability.MUTABLE : SingularAttributeBinding.NaturalIdMutability.IMMUTABLE;
processPropertyAttributes( attributeSources, naturalId.getProperty(), null, naturalIdMutability );
processManyToOneAttributes( attributeSources, naturalId.getManyToOne(), null, naturalIdMutability );
processComponentAttributes( attributeSources, naturalId.getComponent(), null, naturalIdMutability );
processDynamicComponentAttributes( attributeSources, naturalId.getDynamicComponent(), null, naturalIdMutability );
processAnyAttributes( attributeSources, naturalId.getAny(), null, naturalIdMutability );
}
return super.buildAttributeSources( attributeSources );
}
@Override

View File

@ -321,6 +321,11 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:complexType name="natural-id-element">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<simplify:as-element-property/>
</xs:appinfo>
</xs:annotation>
<xs:element name="property" type="property-element"/>
<xs:element name="many-to-one" type="many-to-one-element"/>
<xs:element name="component" type="component-element"/>