Search in sources :

Example 1 with JaxbHbmJoinedSubclassEntityType

use of org.hibernate.boot.jaxb.hbm.spi.JaxbHbmJoinedSubclassEntityType in project hibernate-orm by hibernate.

the class EntityHierarchyBuilder method indexMappingDocument.

/**
	 * Called for each mapping document.
	 *
	 * @param mappingDocument The {@code hbm.xml} document to index
	 */
public void indexMappingDocument(MappingDocument mappingDocument) {
    log.tracef("Indexing mapping document [%s] for purpose of building entity hierarchy ordering", mappingDocument.getOrigin());
    final JaxbHbmHibernateMapping mappingBinding = mappingDocument.getDocumentRoot();
    // iterate all root class definitions at the hibernate-mapping level
    for (JaxbHbmRootEntityType jaxbRootEntity : mappingBinding.getClazz()) {
        // we can immediately handle <class/> elements in terms of creating the hierarchy entry
        final RootEntitySourceImpl rootEntitySource = new RootEntitySourceImpl(mappingDocument, jaxbRootEntity);
        entitySourceByNameMap.put(rootEntitySource.getEntityNamingSource().getEntityName(), rootEntitySource);
        final EntityHierarchySourceImpl hierarchy = new EntityHierarchySourceImpl(rootEntitySource);
        entityHierarchyList.add(hierarchy);
        linkAnyWaiting(mappingDocument, rootEntitySource);
        // process any of its nested sub-entity definitions
        processRootEntitySubEntityElements(mappingDocument, jaxbRootEntity, rootEntitySource);
    }
    // iterate all discriminator-based subclass definitions at the hibernate-mapping level
    for (JaxbHbmDiscriminatorSubclassEntityType discriminatorSubclassEntityBinding : mappingBinding.getSubclass()) {
        processTopLevelSubClassBinding(mappingDocument, discriminatorSubclassEntityBinding);
    }
    // iterate all joined-subclass definitions at the hibernate-mapping level
    for (JaxbHbmJoinedSubclassEntityType joinedSubclassEntityBinding : mappingBinding.getJoinedSubclass()) {
        processTopLevelSubClassBinding(mappingDocument, joinedSubclassEntityBinding);
    }
    // iterate all union-subclass definitions at the hibernate-mapping level
    for (JaxbHbmUnionSubclassEntityType unionSubclassEntityBinding : mappingBinding.getUnionSubclass()) {
        processTopLevelSubClassBinding(mappingDocument, unionSubclassEntityBinding);
    }
}
Also used : JaxbHbmUnionSubclassEntityType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmUnionSubclassEntityType) JaxbHbmDiscriminatorSubclassEntityType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmDiscriminatorSubclassEntityType) JaxbHbmRootEntityType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType) JaxbHbmJoinedSubclassEntityType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmJoinedSubclassEntityType) JaxbHbmHibernateMapping(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmHibernateMapping)

Example 2 with JaxbHbmJoinedSubclassEntityType

use of org.hibernate.boot.jaxb.hbm.spi.JaxbHbmJoinedSubclassEntityType in project hibernate-orm by hibernate.

the class EntityHierarchyBuilder method processSubEntityElements.

private void processSubEntityElements(MappingDocument mappingDocument, JaxbHbmEntityBaseDefinition entityBinding, AbstractEntitySourceImpl container) {
    if (JaxbHbmDiscriminatorSubclassEntityType.class.isInstance(entityBinding)) {
        final JaxbHbmDiscriminatorSubclassEntityType jaxbSubclass = (JaxbHbmDiscriminatorSubclassEntityType) entityBinding;
        processElements(mappingDocument, jaxbSubclass.getSubclass(), container);
    } else if (JaxbHbmJoinedSubclassEntityType.class.isInstance(entityBinding)) {
        final JaxbHbmJoinedSubclassEntityType jaxbJoinedSubclass = (JaxbHbmJoinedSubclassEntityType) entityBinding;
        processElements(mappingDocument, jaxbJoinedSubclass.getJoinedSubclass(), container);
    } else if (JaxbHbmUnionSubclassEntityType.class.isInstance(entityBinding)) {
        final JaxbHbmUnionSubclassEntityType jaxbUnionSubclass = (JaxbHbmUnionSubclassEntityType) entityBinding;
        processElements(mappingDocument, jaxbUnionSubclass.getUnionSubclass(), container);
    }
}
Also used : JaxbHbmUnionSubclassEntityType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmUnionSubclassEntityType) JaxbHbmDiscriminatorSubclassEntityType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmDiscriminatorSubclassEntityType) JaxbHbmJoinedSubclassEntityType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmJoinedSubclassEntityType)

Aggregations

JaxbHbmDiscriminatorSubclassEntityType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmDiscriminatorSubclassEntityType)2 JaxbHbmJoinedSubclassEntityType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmJoinedSubclassEntityType)2 JaxbHbmUnionSubclassEntityType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmUnionSubclassEntityType)2 JaxbHbmHibernateMapping (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmHibernateMapping)1 JaxbHbmRootEntityType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType)1