use of org.hibernate.mapping.UnionSubclass in project hibernate-orm by hibernate.
the class ModelBinder method bindUnionSubclassEntities.
private void bindUnionSubclassEntities(EntitySource entitySource, PersistentClass superEntityDescriptor) {
for (IdentifiableTypeSource subType : entitySource.getSubTypes()) {
final UnionSubclass subEntityDescriptor = new UnionSubclass(superEntityDescriptor, metadataBuildingContext);
bindUnionSubclassEntity((SubclassEntitySourceImpl) subType, subEntityDescriptor);
superEntityDescriptor.addSubclass(subEntityDescriptor);
entitySource.getLocalMetadataBuildingContext().getMetadataCollector().addEntityBinding(subEntityDescriptor);
}
}
use of org.hibernate.mapping.UnionSubclass in project hibernate-orm by hibernate.
the class IdTableHelper method needsIdTable.
public boolean needsIdTable(PersistentClass entityBinding) {
// need id table if the entity has secondary tables (joins)
if (entityBinding.getJoinClosureSpan() > 0) {
return true;
}
// need an id table if the entity is part of either a JOINED or UNION inheritance
// hierarchy. We do not allow inheritance strategy mixing, so work on that assumption
// here...
final RootClass rootEntityBinding = entityBinding.getRootClass();
final Iterator itr = rootEntityBinding.getSubclassIterator();
if (itr.hasNext()) {
final Subclass subclassEntityBinding = (Subclass) itr.next();
if (subclassEntityBinding instanceof JoinedSubclass || subclassEntityBinding instanceof UnionSubclass) {
return true;
}
}
return false;
}
use of org.hibernate.mapping.UnionSubclass in project hibernate-orm by hibernate.
the class PersistentClassVisitorTest method testProperCallbacks.
@Test
public void testProperCallbacks() {
PersistentClassVisitorValidator vv = new PersistentClassVisitorValidator();
new RootClass(metadataBuildingContext).accept(vv);
new Subclass(new RootClass(metadataBuildingContext), metadataBuildingContext).accept(vv);
new JoinedSubclass(new RootClass(metadataBuildingContext), metadataBuildingContext).accept(vv);
new SingleTableSubclass(new RootClass(metadataBuildingContext), metadataBuildingContext).accept(vv);
new UnionSubclass(new RootClass(metadataBuildingContext), metadataBuildingContext).accept(vv);
}
Aggregations