Methods Summary |
---|
public abstract java.lang.Object | accept(PersistentClassVisitor mv)
|
public void | addFilter(java.lang.String name, java.lang.String condition)
filters.put(name, condition);
|
public void | addJoin(Join join)
joins.add(join);
join.setPersistentClass(this);
|
public void | addProperty(Property p)
properties.add(p);
p.setPersistentClass(this);
|
public void | addSubclass(Subclass subclass)
// 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);
|
protected void | addSubclassJoin(Join join)
subclassJoins.add(join);
|
protected void | addSubclassProperty(Property prop)
subclassProperties.add(prop);
|
protected void | addSubclassTable(Table subclassTable)
subclassTables.add(subclassTable);
|
public void | addSynchronizedTable(java.lang.String table)
synchronizedTables.add(table);
|
public void | addTuplizer(org.hibernate.EntityMode entityMode, java.lang.String implClassName)
if ( tuplizerImpls == null ) {
tuplizerImpls = new HashMap();
}
tuplizerImpls.put( entityMode, implClassName );
|
protected void | checkColumnDuplication(java.util.Set distinctColumns, java.util.Iterator columns)
while ( columns.hasNext() ) {
Selectable columnOrFormula = (Selectable) columns.next();
if ( !columnOrFormula.isFormula() ) {
Column col = (Column) columnOrFormula;
if ( !distinctColumns.add( col.getName() ) ) {
throw new MappingException(
"Repeated column in mapping for entity: " +
getEntityName() +
" column: " +
col.getName() +
" (should be mapped with insert=\"false\" update=\"false\")"
);
}
}
}
|
protected void | checkColumnDuplication()
HashSet cols = new HashSet();
if (getIdentifierMapper() == null ) {
//an identifier mapper => getKey will be included in the getNonDuplicatedPropertyIterator()
//and checked later, so it needs to be excluded
checkColumnDuplication( cols, getKey().getColumnIterator() );
}
checkColumnDuplication( cols, getDiscriminatorColumnIterator() );
checkPropertyColumnDuplication( cols, getNonDuplicatedPropertyIterator() );
Iterator iter = getJoinIterator();
while ( iter.hasNext() ) {
cols.clear();
Join join = (Join) iter.next();
checkColumnDuplication( cols, join.getKey().getColumnIterator() );
checkPropertyColumnDuplication( cols, join.getPropertyIterator() );
}
|
protected void | checkPropertyColumnDuplication(java.util.Set distinctColumns, java.util.Iterator properties)
while ( properties.hasNext() ) {
Property prop = (Property) properties.next();
if ( prop.getValue() instanceof Component ) { //TODO: remove use of instanceof!
Component component = (Component) prop.getValue();
checkPropertyColumnDuplication( distinctColumns, component.getPropertyIterator() );
}
else {
if ( prop.isUpdateable() || prop.isInsertable() ) {
checkColumnDuplication( distinctColumns, prop.getColumnIterator() );
}
}
}
|
private void | checkPropertyDuplication()
HashSet names = new HashSet();
Iterator iter = getPropertyIterator();
while ( iter.hasNext() ) {
Property prop = (Property) iter.next();
if ( !names.add( prop.getName() ) ) {
throw new MappingException( "Duplicate property mapping of " + prop.getName() + " found in " + getEntityName());
}
}
|
public void | createPrimaryKey()
//Primary key constraint
PrimaryKey pk = new PrimaryKey();
Table table = getTable();
pk.setTable(table);
pk.setName( PK_ALIAS.toAliasString( table.getName() ) );
table.setPrimaryKey(pk);
pk.addColumns( getKey().getColumnIterator() );
|
public int | getBatchSize()
return batchSize;
|
public abstract java.lang.String | getCacheConcurrencyStrategy()
|
public java.lang.String | getClassName()
return className;
|
public java.lang.String | getCustomSQLDelete()
return customSQLDelete;
|
public org.hibernate.engine.ExecuteUpdateResultCheckStyle | getCustomSQLDeleteCheckStyle()
return deleteCheckStyle;
|
public java.lang.String | getCustomSQLInsert()
return customSQLInsert;
|
public org.hibernate.engine.ExecuteUpdateResultCheckStyle | getCustomSQLInsertCheckStyle()
return insertCheckStyle;
|
public java.lang.String | getCustomSQLUpdate()
return customSQLUpdate;
|
public org.hibernate.engine.ExecuteUpdateResultCheckStyle | getCustomSQLUpdateCheckStyle()
return updateCheckStyle;
|
public java.util.Iterator | getDirectSubclasses()
return subclasses.iterator();
|
public abstract Value | getDiscriminator()
|
protected java.util.Iterator | getDiscriminatorColumnIterator()
return EmptyIterator.INSTANCE;
|
public java.lang.String | getDiscriminatorValue()
return discriminatorValue;
|
public java.lang.String | getEntityName()
return entityName;
|
public abstract java.lang.Class | getEntityPersisterClass()
|
public java.util.Map | getFilterMap()
return filters;
|
public abstract KeyValue | getIdentifier()
|
public Component | getIdentifierMapper()
return identifierMapper;
|
public abstract Property | getIdentifierProperty()
|
public Table | getIdentityTable()
return getRootTable();
|
public java.util.Iterator | getJoinClosureIterator()
return joins.iterator();
|
public int | getJoinClosureSpan()
return joins.size();
|
public java.util.Iterator | getJoinIterator()
return joins.iterator();
|
public int | getJoinNumber(Property prop)
int result=1;
Iterator iter = getSubclassJoinClosureIterator();
while ( iter.hasNext() ) {
Join join = (Join) iter.next();
if ( join.containsProperty(prop) ) return result;
result++;
}
return 0;
|
public abstract KeyValue | getKey()
|
public abstract java.util.Iterator | getKeyClosureIterator()
|
public java.lang.String | getLoaderName()
return loaderName;
|
public java.lang.Class | getMappedClass()
if (className==null) return null;
try {
return ReflectHelper.classForName(className);
}
catch (ClassNotFoundException cnfe) {
throw new MappingException("entity class not found: " + className, cnfe);
}
|
public MetaAttribute | getMetaAttribute(java.lang.String name)
return metaAttributes==null?null:(MetaAttribute) metaAttributes.get(name);
|
public java.util.Map | getMetaAttributes()
return metaAttributes;
|
public java.lang.String | getNodeName()
return nodeName;
|
protected java.util.Iterator | getNonDuplicatedPropertyIterator()
return getUnjoinedPropertyIterator();
|
public abstract int | getOptimisticLockMode()
|
private Property | getProperty(java.lang.String propertyName, java.util.Iterator iterator)
while ( iterator.hasNext() ) {
Property prop = (Property) iterator.next();
if ( prop.getName().equals( StringHelper.root(propertyName) ) ) {
return prop;
}
}
throw new MappingException( "property [" + propertyName + "] not found on entity [" + getEntityName() + "]" );
|
public Property | getProperty(java.lang.String propertyName)
Iterator iter = getPropertyClosureIterator();
Property identifierProperty = getIdentifierProperty();
if ( identifierProperty != null
&& identifierProperty.getName().equals( StringHelper.root(propertyName) )
) {
return identifierProperty;
}
else {
return getProperty( propertyName, iter );
}
|
public abstract java.util.Iterator | getPropertyClosureIterator()
|
public int | getPropertyClosureSpan()
int span = properties.size();
for ( int i=0; i<joins.size(); i++ ) {
Join join = (Join) joins.get(i);
span += join.getPropertySpan();
}
return span;
|
public java.util.Iterator | getPropertyIterator()Build an iterator over the properties defined on this class. The returned
iterator only accounts for "normal" properties (i.e. non-identifier
properties).
Differs from {@link #getUnjoinedPropertyIterator} in that the iterator
we return here will include properties defined as part of a join.
ArrayList iterators = new ArrayList();
iterators.add( properties.iterator() );
for ( int i = 0; i < joins.size(); i++ ) {
Join join = ( Join ) joins.get( i );
iterators.add( join.getPropertyIterator() );
}
return new JoinedIterator( iterators );
|
public java.lang.Class | getProxyInterface()
if (proxyInterfaceName==null) return null;
try {
return ReflectHelper.classForName(proxyInterfaceName);
}
catch (ClassNotFoundException cnfe) {
throw new MappingException("proxy class not found: " + proxyInterfaceName, cnfe);
}
|
public java.lang.String | getProxyInterfaceName()
return proxyInterfaceName;
|
public Property | getRecursiveProperty(java.lang.String propertyPath)
try {
return getRecursiveProperty( propertyPath, getPropertyIterator() );
}
catch ( MappingException e ) {
throw new MappingException(
"property [" + propertyPath + "] not found on entity [" + getEntityName() + "]", e
);
}
|
private Property | getRecursiveProperty(java.lang.String propertyPath, java.util.Iterator iter)
Property property = null;
StringTokenizer st = new StringTokenizer( propertyPath, ".", false );
try {
while ( st.hasMoreElements() ) {
final String element = ( String ) st.nextElement();
if ( property == null ) {
// we are processing the root of the prpertyPath, so we have the following
// considerations:
// 1) specifically account for identifier properties
// 2) specifically account for embedded composite-identifiers
// 3) perform a normal property lookup
Property identifierProperty = getIdentifierProperty();
if ( identifierProperty != null && identifierProperty.getName().equals( element ) ) {
// we have a mapped identifier property and the root of
// the incoming property path matched that identifier
// property
property = identifierProperty;
}
else if ( identifierProperty == null && getIdentifier() != null && Component.class.isInstance( getIdentifier() ) ) {
// we have an embedded composite identifier
try {
identifierProperty = getProperty( element, ( ( Component ) getIdentifier() ).getPropertyIterator() );
if ( identifierProperty != null ) {
// the root of the incoming property path matched one
// of the embedded composite identifier properties
property = identifierProperty;
}
}
catch( MappingException ignore ) {
// ignore it...
}
}
if ( property == null ) {
property = getProperty( element, iter );
}
}
else {
//flat recursive algorithm
property = ( ( Component ) property.getValue() ).getProperty( element );
}
}
}
catch ( MappingException e ) {
throw new MappingException( "property [" + propertyPath + "] not found on entity [" + getEntityName() + "]" );
}
return property;
|
public java.util.Iterator | getReferenceablePropertyIterator()Build an iterator of properties which are "referenceable".
return getPropertyClosureIterator();
|
public Property | getReferencedProperty(java.lang.String propertyPath)Given a property path, locate the appropriate referenceable property reference.
A referenceable property is a property which can be a target of a foreign-key
mapping (an identifier or explcitly named in a property-ref).
try {
return getRecursiveProperty( propertyPath, getReferenceablePropertyIterator() );
}
catch ( MappingException e ) {
throw new MappingException(
"property-ref [" + propertyPath + "] not found on entity [" + getEntityName() + "]", e
);
}
|
public abstract RootClass | getRootClass()
|
public abstract Table | getRootTable()
|
public java.util.Iterator | getSubclassClosureIterator()
ArrayList iters = new ArrayList();
iters.add( new SingletonIterator(this) );
Iterator iter = getSubclassIterator();
while ( iter.hasNext() ) {
PersistentClass clazz = (PersistentClass) iter.next();
iters.add( clazz.getSubclassClosureIterator() );
}
return new JoinedIterator(iters);
|
public abstract int | getSubclassId()
|
public java.util.Iterator | getSubclassIterator()Iterate over subclasses in a special 'order', most derived subclasses
first.
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 java.util.Iterator | getSubclassJoinClosureIterator()
return new JoinedIterator( getJoinClosureIterator(), subclassJoins.iterator() );
|
public java.util.Iterator | getSubclassPropertyClosureIterator()
ArrayList iters = new ArrayList();
iters.add( getPropertyClosureIterator() );
iters.add( subclassProperties.iterator() );
for ( int i=0; i<subclassJoins.size(); i++ ) {
Join join = (Join) subclassJoins.get(i);
iters.add( join.getPropertyIterator() );
}
return new JoinedIterator(iters);
|
public int | getSubclassSpan()
int n = subclasses.size();
Iterator iter = subclasses.iterator();
while ( iter.hasNext() ) {
n += ( (Subclass) iter.next() ).getSubclassSpan();
}
return n;
|
public java.util.Iterator | getSubclassTableClosureIterator()
return new JoinedIterator( getTableClosureIterator(), subclassTables.iterator() );
|
public abstract org.hibernate.mapping.PersistentClass | getSuperclass()
|
public abstract java.util.Set | getSynchronizedTables()
|
public abstract Table | getTable()
|
public abstract java.util.Iterator | getTableClosureIterator()
|
public java.lang.String | getTemporaryIdTableDDL()
return temporaryIdTableDDL;
|
public java.lang.String | getTemporaryIdTableName()
return temporaryIdTableName;
|
public java.lang.String | getTuplizerImplClassName(org.hibernate.EntityMode mode)
if ( tuplizerImpls == null ) return null;
return ( String ) tuplizerImpls.get( mode );
|
public java.util.Map | getTuplizerMap()
if ( tuplizerImpls == null ) {
return null;
}
return java.util.Collections.unmodifiableMap( tuplizerImpls );
|
public java.util.Iterator | getUnjoinedPropertyIterator()Build an iterator over the properties defined on this class which
are not defined as part of a join. As with {@link #getPropertyIterator},
the returned iterator only accounts for non-identifier properties.
return properties.iterator();
|
public abstract Property | getVersion()
|
public abstract java.lang.String | getWhere()
|
public boolean | hasDom4jRepresentation()
return getNodeName()!=null;
|
public abstract boolean | hasEmbeddedIdentifier()
|
public boolean | hasIdentifierMapper()
return identifierMapper != null;
|
public abstract boolean | hasIdentifierProperty()
|
public boolean | hasNaturalId()
Iterator props = getRootClass().getPropertyIterator();
while ( props.hasNext() ) {
if ( ( (Property) props.next() ).isNaturalIdentifier() ) {
return true;
}
}
return false;
|
public boolean | hasPojoRepresentation()
return getClassName()!=null;
|
public boolean | hasSelectBeforeUpdate()
return selectBeforeUpdate;
|
public boolean | hasSubclasses()
return subclasses.size() > 0;
|
public boolean | hasSubselectLoadableCollections()
return hasSubselectLoadableCollections;
|
public java.lang.Boolean | isAbstract()
return isAbstract;
|
public boolean | isClassOrSuperclassJoin(Join join)
return joins.contains(join);
|
public boolean | isClassOrSuperclassTable(Table closureTable)
return getTable()==closureTable;
|
public boolean | isCustomDeleteCallable()
return customDeleteCallable;
|
public boolean | isCustomInsertCallable()
return customInsertCallable;
|
public boolean | isCustomUpdateCallable()
return customUpdateCallable;
|
public abstract boolean | isDiscriminatorInsertable()
|
public boolean | isDiscriminatorValueNotNull()
return NOT_NULL_DISCRIMINATOR_MAPPING.equals( getDiscriminatorValue() );
|
public boolean | isDiscriminatorValueNull()
return NULL_DISCRIMINATOR_MAPPING.equals( getDiscriminatorValue() );
|
public abstract boolean | isExplicitPolymorphism()
|
public boolean | isForceDiscriminator()
return false;
|
public abstract boolean | isInherited()
|
public abstract boolean | isJoinedSubclass()
|
public boolean | isLazy()
return lazy;
|
public abstract boolean | isLazyPropertiesCacheable()
|
public abstract boolean | isMutable()
|
public abstract boolean | isPolymorphic()
|
public abstract boolean | isVersioned()
|
abstract int | nextSubclassId()
|
public void | prepareTemporaryTables(org.hibernate.engine.Mapping mapping, org.hibernate.dialect.Dialect dialect)
if ( dialect.supportsTemporaryTables() ) {
temporaryIdTableName = dialect.generateTemporaryTableName( getTable().getName() );
Table table = new Table();
table.setName( temporaryIdTableName );
Iterator itr = getTable().getPrimaryKey().getColumnIterator();
while( itr.hasNext() ) {
Column column = (Column) itr.next();
table.addColumn( (Column) column.clone() );
}
temporaryIdTableDDL = table.sqlTemporaryTableCreateString( dialect, mapping );
}
|
public void | setAbstract(java.lang.Boolean isAbstract)
this.isAbstract = isAbstract;
|
public void | setBatchSize(int batchSize)
this.batchSize = batchSize;
|
public void | setClassName(java.lang.String className)
this.className = className==null ? null : className.intern();
|
public void | setCustomSQLDelete(java.lang.String customSQLDelete, boolean callable, org.hibernate.engine.ExecuteUpdateResultCheckStyle checkStyle)
this.customSQLDelete = customSQLDelete;
this.customDeleteCallable = callable;
this.deleteCheckStyle = checkStyle;
|
public void | setCustomSQLInsert(java.lang.String customSQLInsert, boolean callable, org.hibernate.engine.ExecuteUpdateResultCheckStyle checkStyle)
this.customSQLInsert = customSQLInsert;
this.customInsertCallable = callable;
this.insertCheckStyle = checkStyle;
|
public void | setCustomSQLUpdate(java.lang.String customSQLUpdate, boolean callable, org.hibernate.engine.ExecuteUpdateResultCheckStyle checkStyle)
this.customSQLUpdate = customSQLUpdate;
this.customUpdateCallable = callable;
this.updateCheckStyle = checkStyle;
|
public void | setDiscriminatorValue(java.lang.String discriminatorValue)
this.discriminatorValue = discriminatorValue;
|
public void | setDynamicInsert(boolean dynamicInsert)
this.dynamicInsert = dynamicInsert;
|
public void | setDynamicUpdate(boolean dynamicUpdate)
this.dynamicUpdate = dynamicUpdate;
|
public void | setEntityName(java.lang.String entityName)
this.entityName = entityName==null ? null : entityName.intern();
|
public abstract void | setEntityPersisterClass(java.lang.Class classPersisterClass)
|
public void | setIdentifierMapper(Component handle)
this.identifierMapper = handle;
|
public void | setLazy(boolean lazy)
this.lazy = lazy;
|
public void | setLoaderName(java.lang.String loaderName)
this.loaderName = loaderName==null ? null : loaderName.intern();
|
public void | setMetaAttributes(java.util.Map metas)
this.metaAttributes = metas;
|
public void | setNodeName(java.lang.String nodeName)
this.nodeName = nodeName;
|
public void | setOptimisticLockMode(int optimisticLockMode)
this.optimisticLockMode = optimisticLockMode;
|
public void | setProxyInterfaceName(java.lang.String proxyInterfaceName)
this.proxyInterfaceName = proxyInterfaceName;
|
public void | setSelectBeforeUpdate(boolean selectBeforeUpdate)
this.selectBeforeUpdate = selectBeforeUpdate;
|
public void | setSubselectLoadableCollections(boolean hasSubselectCollections)
this.hasSubselectLoadableCollections = hasSubselectCollections;
|
public java.lang.String | toString()
return getClass().getName() + '(" + getEntityName() + ')";
|
public boolean | useDynamicInsert()
return dynamicInsert;
|
public boolean | useDynamicUpdate()
return dynamicUpdate;
|
public void | validate(org.hibernate.engine.Mapping mapping)
Iterator iter = getPropertyIterator();
while ( iter.hasNext() ) {
Property prop = (Property) iter.next();
if ( !prop.isValid(mapping) ) {
throw new MappingException(
"property mapping has wrong number of columns: " +
StringHelper.qualify( getEntityName(), prop.getName() ) +
" type: " +
prop.getType().getName()
);
}
}
checkPropertyDuplication();
checkColumnDuplication();
|