while ( subclasses.hasNext() ) { final Subclass subclass = subclasses.next(); final Class subclassProxy = subclass.getProxyInterface(); final Class subclassClass = subclass.getMappedClass(); if ( subclassProxy != null && !subclassClass.equals( subclassProxy ) ) { if ( !subclassProxy.isInterface() ) { throw new MappingException( "proxy must be either an interface, or the class itself: " + subclass.getEntityName() );
public Iterator getTableClosureIterator() { return new JoinedIterator( getSuperclass().getTableClosureIterator(), new SingletonIterator( getTable() ) ); } public Iterator getKeyClosureIterator() {
public void createForeignKey() { if ( !isJoinedSubclass() ) { throw new AssertionFailure( "not a joined-subclass" ); } getKey().createForeignKeyOfEntity( getSuperclass().getEntityName() ); }
public boolean isJoinedSubclass() { return getTable()!=getRootTable(); }
public Iterator getPropertyClosureIterator() { return new JoinedIterator( getSuperclass().getPropertyClosureIterator(), getPropertyIterator() ); } public Iterator getTableClosureIterator() {
public static void bindSubclass(Element node, Subclass subclass, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { bindClass( node, subclass, mappings, inheritedMetas ); inheritedMetas = getMetas( node, inheritedMetas, true ); // get meta's from <subclass> if ( subclass.getEntityPersisterClass() == null ) { subclass.getRootClass().setEntityPersisterClass( SingleTableEntityPersister.class ); } log.info( "Mapping subclass: " + subclass.getEntityName() + " -> " + subclass.getTable().getName() ); // properties createClassProperties( node, subclass, mappings, inheritedMetas ); }
while ( iter.hasNext() ) { Subclass sc = (Subclass) iter.next(); subclassClosure[k] = sc.getEntityName(); try { if ( persistentClass.isPolymorphic() ) { final Object discriminatorValue; if ( explicitDiscriminatorColumnName != null ) { if ( sc.isDiscriminatorValueNull() ) { discriminatorValue = NULL_DISCRIMINATOR; else if ( sc.isDiscriminatorValueNotNull() ) { discriminatorValue = NOT_NULL_DISCRIMINATOR; discriminatorValue = discriminatorType.stringToObject( sc.getDiscriminatorValue() ); discriminatorValue = sc.getSubclassId(); subclassesByDiscriminatorValue.put( discriminatorValue, sc.getEntityName() ); discriminatorValues[k] = discriminatorValue.toString(); int id = getTableId( sc.getTable().getQualifiedName( factory.getDialect(), factory.getSettings().getDefaultCatalogName(),
while ( iter.hasNext() ) { Subclass sc = (Subclass) iter.next(); subclassClosure[k] = sc.getEntityName(); try { if ( persistentClass.isPolymorphic() ) { Integer subclassId = new Integer( sc.getSubclassId() );//new Integer(k+1); subclassesByDiscriminatorValue.put( subclassId, sc.getEntityName() ); discriminatorValues[k] = subclassId.toString(); int id = getTableId( sc.getTable().getQualifiedName( factory.getDialect(), factory.getSettings().getDefaultCatalogName(),
public Iterator getKeyClosureIterator() { return new JoinedIterator( getSuperclass().getKeyClosureIterator(), new SingletonIterator( getKey() ) ); } protected void addSubclassProperty(Property p) {
while ( iter.hasNext() ) { Subclass sc = (Subclass) iter.next(); subclassClosure[k++] = sc.getEntityName(); subclassByDiscriminatorValue.put( sc.getSubclassId(), sc.getEntityName() );
while ( iter.hasNext() ) { Subclass sc = (Subclass) iter.next(); subclassClosure[k++] = sc.getEntityName(); if ( sc.isDiscriminatorValueNull() ) { addSubclassByDiscriminatorValue( NULL_DISCRIMINATOR, sc.getEntityName() ); else if ( sc.isDiscriminatorValueNotNull() ) { addSubclassByDiscriminatorValue( NOT_NULL_DISCRIMINATOR, sc.getEntityName() ); DiscriminatorType dtype = (DiscriminatorType) discriminatorType; addSubclassByDiscriminatorValue( dtype.stringToObject( sc.getDiscriminatorValue() ), sc.getEntityName() );
public void validate(Mapping mapping) throws MappingException { if ( getDiscriminator() == null ) { throw new MappingException( "No discriminator found for " + getEntityName() + ". Discriminator is needed when 'single-table-per-hierarchy' " + "is used and a class has subclasses" ); } super.validate( mapping ); } }
public Class getEntityPersisterClass() { if (classPersisterClass==null) { return getSuperclass().getEntityPersisterClass(); } else { return classPersisterClass; } }
public static void bindSubclass(Element node, Subclass subclass, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { bindClass( node, subclass, mappings, inheritedMetas ); inheritedMetas = getMetas( node, inheritedMetas, true ); // get meta's from <subclass> if ( LOG.isDebugEnabled() ) { LOG.debugf( "Mapping subclass: %s -> %s", subclass.getEntityName(), subclass.getTable().getName() ); } // properties createClassProperties( node, subclass, mappings, inheritedMetas ); }
public void addSubclass(Subclass subclass) throws MappingException { // inheritance cycle detection (paranoid check) PersistentClass superclass = getSuperclass(); while ( superclass != null ) { if ( subclass.getEntityName().equals( superclass.getEntityName() ) ) { throw new MappingException( "Circular inheritance mapping detected: " + subclass.getEntityName() + " will have it self as superclass when extending " + getEntityName() ); } superclass = superclass.getSuperclass(); } subclasses.add( subclass ); }
/** * Iterate over subclasses in a special 'order', most derived subclasses * first. */ public Iterator getSubclassIterator() { Iterator[] iters = new Iterator[subclasses.size() + 1]; Iterator iter = subclasses.iterator(); int i = 0; while ( iter.hasNext() ) { iters[i++] = ( (Subclass) iter.next() ).getSubclassIterator(); } iters[i] = subclasses.iterator(); return new JoinedIterator( iters ); }
public String getCacheConcurrencyStrategy() { return getRootClass().getCacheConcurrencyStrategy(); }
public static void bindSubclass(Element node, Subclass subclass, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { bindClass( node, subclass, mappings, inheritedMetas ); inheritedMetas = getMetas( node, inheritedMetas, true ); // get meta's from <subclass> if ( subclass.getEntityPersisterClass() == null ) { subclass.getRootClass() .setEntityPersisterClass( SingleTableEntityPersister.class ); } log.info( "Mapping subclass: " + subclass.getEntityName() + " -> " + subclass.getTable().getName() ); // properties createClassProperties( node, subclass, mappings, inheritedMetas ); }
while ( iter.hasNext() ) { Subclass sc = (Subclass) iter.next(); subclassClosure[k] = sc.getEntityName(); try { if ( persistentClass.isPolymorphic() ) { Integer subclassId = sc.getSubclassId(); subclassesByDiscriminatorValue.put( subclassId, sc.getEntityName() ); discriminatorValues[k] = subclassId.toString(); int id = getTableId( sc.getTable().getQualifiedName( factory.getDialect(), factory.getSettings().getDefaultCatalogName(),
public boolean isJoinedSubclass() { return getTable()!=getRootTable(); }