private void bindDiscriminatorSubclassEntities( AbstractEntitySourceImpl entitySource, PersistentClass superEntityDescriptor) { for ( IdentifiableTypeSource subType : entitySource.getSubTypes() ) { final SingleTableSubclass subEntityDescriptor = new SingleTableSubclass( superEntityDescriptor, metadataBuildingContext ); bindDiscriminatorSubclassEntity( (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 handleSubclass(PersistentClass model, Mappings mappings, Element subnode, java.util.Map inheritedMetas) throws MappingException { Subclass subclass = new SingleTableSubclass( model ); bindSubclass( subnode, subclass, mappings, inheritedMetas ); model.addSubclass( subclass ); mappings.addClass( subclass ); }
private static void handleSubclass(PersistentClass model, Mappings mappings, Element subnode, java.util.Map inheritedMetas) throws MappingException { Subclass subclass = new SingleTableSubclass( model ); bindSubclass( subnode, subclass, mappings, inheritedMetas ); model.addSubclass( subclass ); mappings.addClass( subclass ); }
private static void handleSubclass(PersistentClass model, Mappings mappings, Element subnode, java.util.Map inheritedMetas) throws MappingException { Subclass subclass = new SingleTableSubclass( model ); bindSubclass( subnode, subclass, mappings, inheritedMetas ); model.addSubclass( subclass ); mappings.addClass( subclass ); }
private static void handleSubclass(PersistentClass model, Mappings mappings, Element subnode, java.util.Map inheritedMetas) throws MappingException { Subclass subclass = new SingleTableSubclass( model ); bindSubclass( subnode, subclass, mappings, inheritedMetas ); model.addSubclass( subclass ); mappings.addClass( subclass ); }
private void bindDiscriminatorSubclassEntities( AbstractEntitySourceImpl superEntitySource, PersistentClass superEntityDescriptor) { for ( IdentifiableTypeSource subTypeSource : superEntitySource.getSubTypes() ) { final SingleTableSubclass subEntityDescriptor = new SingleTableSubclass( superEntityDescriptor, metadataBuildingContext ); bindDiscriminatorSubclassEntity( (SubclassEntitySourceImpl) subTypeSource, subEntityDescriptor ); superEntityDescriptor.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 JoinedSubclass(parent); } else { subClass = new SingleTableSubclass(parent);
subClass = new SingleTableSubclass(parent);
persistentClass = new SingleTableSubclass( superEntity );