use of org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType 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);
}
}
use of org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType in project hibernate-orm by hibernate.
the class AbstractEntitySourceImpl method buildFilterSources.
private FilterSource[] buildFilterSources() {
//todo for now, i think all EntityElement should support this.
if (JaxbHbmRootEntityType.class.isInstance(jaxbEntityMapping())) {
final JaxbHbmRootEntityType jaxbClassElement = (JaxbHbmRootEntityType) jaxbEntityMapping();
final int size = jaxbClassElement.getFilter().size();
if (size == 0) {
return NO_FILTER_SOURCES;
}
FilterSource[] results = new FilterSource[size];
for (int i = 0; i < size; i++) {
JaxbHbmFilterType element = jaxbClassElement.getFilter().get(i);
results[i] = new FilterSourceImpl(sourceMappingDocument(), element);
}
return results;
} else {
return NO_FILTER_SOURCES;
}
}
use of org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType in project hibernate-orm by hibernate.
the class EntityModeConverterTest method generateXml.
private JaxbHbmHibernateMapping generateXml(boolean includeEntityMode) throws Exception {
JaxbHbmHibernateMapping hm = new JaxbHbmHibernateMapping();
JaxbHbmRootEntityType clazz = new JaxbHbmRootEntityType();
JaxbHbmTuplizerType tuplizer = new JaxbHbmTuplizerType();
tuplizer.setClazz(DynamicMapEntityTuplizer.class.getCanonicalName());
if (includeEntityMode) {
tuplizer.setEntityMode(EntityMode.MAP);
}
clazz.getTuplizer().add(tuplizer);
JaxbHbmSimpleIdType id = new JaxbHbmSimpleIdType();
clazz.setId(id);
hm.getClazz().add(clazz);
return hm;
}
use of org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType in project hibernate-orm by hibernate.
the class GenerationTimingConverterTest method testMashallAttributeWithNullGenerationTiming.
@Test
public void testMashallAttributeWithNullGenerationTiming() throws Exception {
JaxbHbmHibernateMapping hm = new JaxbHbmHibernateMapping();
JaxbHbmRootEntityType clazz = new JaxbHbmRootEntityType();
JaxbHbmSimpleIdType id = new JaxbHbmSimpleIdType();
JaxbHbmBasicAttributeType att = new JaxbHbmBasicAttributeType();
att.setName("attributeName");
clazz.getAttributes().add(att);
clazz.setId(id);
hm.getClazz().add(clazz);
XmlBindingChecker.checkValidGeneration(hm);
}
Aggregations