FileDocCategorySizeDatePackage
RootClass.javaAPI DocHibernate 3.2.56923Tue Nov 29 07:34:12 GMT 2005org.hibernate.mapping

RootClass

public class RootClass extends PersistentClass implements TableOwner
The root class of an inheritance hierarchy
author
Gavin King

Fields Summary
public static final String
DEFAULT_IDENTIFIER_COLUMN_NAME
public static final String
DEFAULT_DISCRIMINATOR_COLUMN_NAME
private Property
identifierProperty
private KeyValue
identifier
private Property
version
private boolean
polymorphic
private String
cacheConcurrencyStrategy
private String
cacheRegionName
private boolean
lazyPropertiesCacheable
private Value
discriminator
private boolean
mutable
private boolean
embeddedIdentifier
private boolean
explicitPolymorphism
private Class
entityPersisterClass
private boolean
forceDiscriminator
private String
where
private Table
table
private boolean
discriminatorInsertable
private int
nextSubclassId
Constructors Summary
Methods Summary
public java.lang.Objectaccept(PersistentClassVisitor mv)

		return mv.accept(this);
	
public voidaddSubclass(Subclass subclass)

		super.addSubclass(subclass);
		setPolymorphic(true);
	
private voidcheckCompositeIdentifier()

		if ( getIdentifier() instanceof Component ) {
			Component id = (Component) getIdentifier();
			if ( !id.isDynamic() ) {
				Class idClass = id.getComponentClass();
				if ( idClass != null && !ReflectHelper.overridesEquals( idClass ) ) {
					LogFactory.getLog(RootClass.class)
						.warn( "composite-id class does not override equals(): "
							+ id.getComponentClass().getName() );
				}
				if ( !ReflectHelper.overridesHashCode( idClass ) ) {
					LogFactory.getLog(RootClass.class)
						.warn( "composite-id class does not override hashCode(): "
							+ id.getComponentClass().getName() );
				}
				if ( !Serializable.class.isAssignableFrom( idClass ) ) {
					throw new MappingException( "composite-id class must implement Serializable: "
						+ id.getComponentClass().getName() );
				}
			}
		}
	
public java.lang.StringgetCacheConcurrencyStrategy()

		return cacheConcurrencyStrategy;
	
public java.lang.StringgetCacheRegionName()

		return cacheRegionName==null ? getEntityName() : cacheRegionName;
	
public ValuegetDiscriminator()

		return discriminator;
	
public java.lang.ClassgetEntityPersisterClass()

		return entityPersisterClass;
	
public KeyValuegetIdentifier()

		return identifier;
	
public PropertygetIdentifierProperty()

		return identifierProperty;
	
public java.util.SetgetIdentityTables()

		Set tables = new HashSet();
		Iterator iter = getSubclassClosureIterator();
		while ( iter.hasNext() ) {
			PersistentClass clazz = (PersistentClass) iter.next();
			if ( clazz.isAbstract() == null || !clazz.isAbstract().booleanValue() ) tables.add( clazz.getIdentityTable() );
		}
		return tables;
	
public KeyValuegetKey()

		return getIdentifier();
	
public java.util.IteratorgetKeyClosureIterator()

		return new SingletonIterator( getKey() );
	
public intgetOptimisticLockMode()

		return optimisticLockMode;
	
public java.util.IteratorgetPropertyClosureIterator()

		return getPropertyIterator();
	
public org.hibernate.mapping.RootClassgetRootClass()

		return this;
	
public TablegetRootTable()

		return getTable();
	
public intgetSubclassId()

		return 0;
	
public PersistentClassgetSuperclass()

		return null;
	
public java.util.SetgetSynchronizedTables()

		return synchronizedTables;
	
public TablegetTable()

		return table;
	
public java.util.IteratorgetTableClosureIterator()

		return new SingletonIterator( getTable() );
	
public PropertygetVersion()

		return version;
	
public java.lang.StringgetWhere()

		return where;
	
public booleanhasEmbeddedIdentifier()

		return embeddedIdentifier;
	
public booleanhasIdentifierProperty()

		return identifierProperty!=null;
	
public booleanisDiscriminatorInsertable()

		return discriminatorInsertable;
	
public booleanisExplicitPolymorphism()

		return explicitPolymorphism;
	
public booleanisForceDiscriminator()

		return forceDiscriminator;
	
public booleanisInherited()

		return false;
	
public booleanisJoinedSubclass()

		return false;
	
public booleanisLazyPropertiesCacheable()

		return lazyPropertiesCacheable;
	
public booleanisMutable()

		return mutable;
	
public booleanisPolymorphic()

		return polymorphic;
	
public booleanisVersioned()

		return version!=null;
	
intnextSubclassId()

		
	  
		return ++nextSubclassId;
	
public voidsetCacheConcurrencyStrategy(java.lang.String cacheConcurrencyStrategy)

		this.cacheConcurrencyStrategy = cacheConcurrencyStrategy;
	
public voidsetCacheRegionName(java.lang.String cacheRegionName)

		this.cacheRegionName = cacheRegionName;
	
public voidsetDiscriminator(Value discriminator)

		this.discriminator = discriminator;
	
public voidsetDiscriminatorInsertable(boolean insertable)

		this.discriminatorInsertable = insertable;
	
public voidsetEmbeddedIdentifier(boolean embeddedIdentifier)

		this.embeddedIdentifier = embeddedIdentifier;
	
public voidsetEntityPersisterClass(java.lang.Class persister)

		this.entityPersisterClass = persister;
	
public voidsetExplicitPolymorphism(boolean explicitPolymorphism)

		this.explicitPolymorphism = explicitPolymorphism;
	
public voidsetForceDiscriminator(boolean forceDiscriminator)

		this.forceDiscriminator = forceDiscriminator;
	
public voidsetIdentifier(KeyValue identifier)

		this.identifier = identifier;
	
public voidsetIdentifierProperty(Property identifierProperty)

		this.identifierProperty = identifierProperty;
		identifierProperty.setPersistentClass(this);
	
public voidsetLazyPropertiesCacheable(boolean lazyPropertiesCacheable)

		this.lazyPropertiesCacheable = lazyPropertiesCacheable;
	
public voidsetMutable(boolean mutable)

		this.mutable = mutable;
	
public voidsetPolymorphic(boolean polymorphic)

		this.polymorphic = polymorphic;
	
public voidsetTable(Table table)

		this.table=table;
	
public voidsetVersion(Property version)

		this.version = version;
	
public voidsetWhere(java.lang.String string)

		where = string;
	
public voidvalidate(org.hibernate.engine.Mapping mapping)

		super.validate(mapping);
		if ( !getIdentifier().isValid(mapping) ) {
			throw new MappingException(
				"identifier mapping has wrong number of columns: " +
				getEntityName() +
				" type: " +
				getIdentifier().getType().getName()
			);
		}
		checkCompositeIdentifier();