Search in sources :

Example 1 with IdentifierSourceAggregatedComposite

use of org.hibernate.boot.model.source.spi.IdentifierSourceAggregatedComposite in project hibernate-orm by hibernate.

the class ModelBinder method bindAggregatedCompositeEntityIdentifier.

private void bindAggregatedCompositeEntityIdentifier(MappingDocument mappingDocument, EntityHierarchySourceImpl hierarchySource, RootClass rootEntityDescriptor) {
    // an aggregated composite-id is a composite-id that defines a singular
    // (composite) attribute as part of the entity to represent the id.
    final IdentifierSourceAggregatedComposite identifierSource = (IdentifierSourceAggregatedComposite) hierarchySource.getIdentifierSource();
    final Component cid = new Component(mappingDocument.getMetadataCollector(), rootEntityDescriptor);
    cid.setKey(true);
    rootEntityDescriptor.setIdentifier(cid);
    final String idClassName = extractIdClassName(identifierSource);
    final String idPropertyName = identifierSource.getIdentifierAttributeSource().getName();
    final String pathPart = idPropertyName == null ? "<id>" : idPropertyName;
    bindComponent(mappingDocument, hierarchySource.getRoot().getAttributeRoleBase().append(pathPart).getFullPath(), identifierSource.getEmbeddableSource(), cid, idClassName, rootEntityDescriptor.getClassName(), idPropertyName, idClassName == null && idPropertyName == null, identifierSource.getEmbeddableSource().isDynamic(), identifierSource.getIdentifierAttributeSource().getXmlNodeName());
    finishBindingCompositeIdentifier(mappingDocument, rootEntityDescriptor, identifierSource, cid, idPropertyName);
}
Also used : Component(org.hibernate.mapping.Component) IdentifierSourceAggregatedComposite(org.hibernate.boot.model.source.spi.IdentifierSourceAggregatedComposite)

Aggregations

IdentifierSourceAggregatedComposite (org.hibernate.boot.model.source.spi.IdentifierSourceAggregatedComposite)1 Component (org.hibernate.mapping.Component)1