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 ); } }
private static PersistentClass makePersistentClass( InheritanceState inheritanceState, PersistentClass superEntity, MetadataBuildingContext metadataBuildingContext) { //we now know what kind of persistent entity it is if ( !inheritanceState.hasParents() ) { return new RootClass( metadataBuildingContext ); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { return new SingleTableSubclass( superEntity, metadataBuildingContext ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { return new JoinedSubclass( superEntity, metadataBuildingContext ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { return new UnionSubclass( superEntity, metadataBuildingContext ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } }
@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 ); }
private static PersistentClass makePersistentClass(InheritanceState inheritanceState, PersistentClass superEntity) { //we now know what kind of persistent entity it is PersistentClass persistentClass; //create persistent class if ( !inheritanceState.hasParents() ) { persistentClass = new RootClass(); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { persistentClass = new SingleTableSubclass( superEntity ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { persistentClass = new JoinedSubclass( superEntity ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { persistentClass = new UnionSubclass( superEntity ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } return persistentClass; }
private static void handleUnionSubclass(PersistentClass model, Mappings mappings, Element subnode, java.util.Map inheritedMetas) throws MappingException { UnionSubclass subclass = new UnionSubclass( model ); bindUnionSubclass( subnode, subclass, mappings, inheritedMetas ); model.addSubclass( subclass ); mappings.addClass( subclass ); }
private static void handleUnionSubclass(PersistentClass model, Mappings mappings, Element subnode, java.util.Map inheritedMetas) throws MappingException { UnionSubclass subclass = new UnionSubclass( model ); bindUnionSubclass( subnode, subclass, mappings, inheritedMetas ); model.addSubclass( subclass ); mappings.addClass( subclass ); }
private static void handleUnionSubclass(PersistentClass model, Mappings mappings, Element subnode, java.util.Map inheritedMetas) throws MappingException { UnionSubclass subclass = new UnionSubclass( model ); bindUnionSubclass( subnode, subclass, mappings, inheritedMetas ); model.addSubclass( subclass ); mappings.addClass( subclass ); }
private static void handleUnionSubclass(PersistentClass model, Mappings mappings, Element subnode, java.util.Map inheritedMetas) throws MappingException { UnionSubclass subclass = new UnionSubclass( model ); bindUnionSubclass( subnode, subclass, mappings, inheritedMetas ); model.addSubclass( subclass ); mappings.addClass( subclass ); }
private void bindUnionSubclassEntities( EntitySource superEntitySource, PersistentClass superEntityMapping) { for ( IdentifiableTypeSource subTypeSource : superEntitySource.getSubTypes() ) { final UnionSubclass subEntityDescriptor = new UnionSubclass( superEntityMapping, metadataBuildingContext ); bindUnionSubclassEntity( (SubclassEntitySourceImpl) subTypeSource, subEntityDescriptor ); superEntityMapping.addSubclass( subEntityDescriptor ); superEntitySource.getLocalMetadataBuildingContext().getMetadataCollector().addEntityBinding( subEntityDescriptor ); } }
private static PersistentClass makePersistentClass(InheritanceState inheritanceState, PersistentClass superEntity) { //we now know what kind of persistent entity it is PersistentClass persistentClass; //create persistent class if ( !inheritanceState.hasParents() ) { persistentClass = new RootClass(); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { persistentClass = new SingleTableSubclass( superEntity ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { persistentClass = new JoinedSubclass( superEntity ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { persistentClass = new UnionSubclass( superEntity ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } return persistentClass; }
private static PersistentClass makePersistentClass( InheritanceState inheritanceState, PersistentClass superEntity, MetadataBuildingContext metadataBuildingContext) { //we now know what kind of persistent entity it is if ( !inheritanceState.hasParents() ) { return new RootClass( metadataBuildingContext ); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { return new SingleTableSubclass( superEntity, metadataBuildingContext ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { return new JoinedSubclass( superEntity, metadataBuildingContext ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { return new UnionSubclass( superEntity, metadataBuildingContext ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } }
private static PersistentClass makePersistentClass(InheritanceState inheritanceState, PersistentClass superEntity) { //we now know what kind of persistent entity it is PersistentClass persistentClass; //create persistent class if ( !inheritanceState.hasParents() ) { persistentClass = new RootClass(); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) { persistentClass = new SingleTableSubclass( superEntity ); } else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) { persistentClass = new JoinedSubclass( superEntity ); } else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) { persistentClass = new UnionSubclass( superEntity ); } else { throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.getType() ); } return persistentClass; }
subClass = new UnionSubclass(parent);
persistentClass = new UnionSubclass( superEntity );