Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.hibernate.persister.collection.AbstractCollectionPersister
public abstract class AbstractCollectionPersister
extends java.lang.Object
implements CollectionMetadata, SQLLoadableCollection
BasicCollectionPersister
, OneToManyPersister
Field Summary | |
protected int | |
protected String[] | |
protected boolean[] | |
protected boolean[] | |
protected String[] | |
protected String[] | |
protected String[] | |
protected boolean | |
protected Type | |
protected boolean | |
protected boolean | |
protected boolean | |
protected String | |
protected String[] | |
protected boolean[] | |
protected String[] | |
protected boolean | |
protected String[] | |
protected String[] | |
protected String[] | |
protected String[] | |
protected String | |
protected String |
Constructor Summary | |
|
Method Summary | |
protected void |
|
protected void |
|
protected void |
|
protected abstract CollectionInitializer |
|
protected abstract CollectionInitializer |
|
protected Object |
|
void |
|
protected abstract int |
|
boolean |
|
protected String |
|
String |
|
protected abstract String | |
protected abstract String | |
protected String | |
protected String | |
protected abstract String | |
protected SelectFragment |
|
protected String | |
protected String |
|
protected abstract String | |
protected CollectionInitializer |
|
CollectionRegionAccessStrategy |
|
CacheEntryStructure |
|
CollectionMetadata | |
String[] |
|
Serializable[] |
|
CollectionType |
|
protected ExecuteUpdateResultCheckStyle | |
protected ExecuteUpdateResultCheckStyle | |
protected Dialect | |
Object |
|
Class |
|
String[] |
|
String[] |
|
String[] |
|
String | |
EntityPersister |
|
Type |
|
SessionFactoryImplementor | |
FetchMode |
|
String |
|
String | |
IdentifierGenerator |
|
Type |
|
String[] |
|
String[] |
|
String[] |
|
String[] |
|
String | |
Type |
|
protected ExecuteUpdateResultCheckStyle | |
String[] |
|
String[] |
|
Type |
|
String |
|
String |
|
String |
|
String | |
String | |
EntityPersister |
|
String |
|
protected String | |
protected String | |
protected SQLExceptionConverter | |
protected String | |
String |
|
protected String | |
protected String |
|
int |
|
String |
|
Type |
|
protected ExecuteUpdateResultCheckStyle | |
boolean |
|
boolean |
|
boolean | |
boolean |
|
boolean |
|
boolean |
|
protected Object |
|
boolean |
|
void | |
void |
|
void |
|
boolean | |
boolean |
|
boolean |
|
protected boolean | |
protected boolean | |
boolean | |
protected boolean | |
boolean |
|
boolean |
|
abstract boolean |
|
boolean |
|
boolean |
|
protected boolean | |
protected boolean | |
boolean | |
protected boolean | |
boolean |
|
protected void | |
String |
|
void | |
Object |
|
Object |
|
Object |
|
Object |
|
void |
|
void |
|
String |
|
String[] |
|
String[] |
|
String |
|
Type |
|
void |
|
protected int |
|
protected int |
|
int |
|
protected int |
|
protected int |
|
protected int |
|
protected final int batchSize
protected final String[] elementColumnAliases
protected final boolean[] elementColumnIsInPrimaryKey
protected final boolean[] elementColumnIsSettable
protected final String[] elementColumnNames
protected final String[] elementFormulaTemplates
protected final String[] elementFormulas
protected final boolean elementIsPureFormula
protected final boolean hasIdentifier
protected final boolean hasIndex
protected final boolean hasWhere
protected final String identifierColumnName
protected final String[] indexColumnAliases
protected final boolean[] indexColumnIsSettable
protected final String[] indexColumnNames
protected final boolean indexContainsFormula
protected final String[] indexFormulaTemplates
protected final String[] indexFormulas
protected final String[] keyColumnAliases
protected final String[] keyColumnNames
protected final String qualifiedTableName
protected final String sqlWhereString
public AbstractCollectionPersister(Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory) throws MappingException, CacheException
protected abstract CollectionInitializer createCollectionInitializer(Map enabledFilters) throws MappingException
protected abstract CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session)
protected Object decrementIndexByBase(Object index)
public void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws HibernateException
Delete the persistent state of any elements that were removed from the collection
- Specified by:
- deleteRows in interface CollectionPersister
protected abstract int doUpdateRows(Serializable key, PersistentCollection collection, SessionImplementor session) throws HibernateException
public boolean elementExists(Serializable key, Object element, SessionImplementor session)
- Specified by:
- elementExists in interface CollectionPersister
public String filterFragment(String alias, Map enabledFilters) throws MappingException
Get the where clause filter, given a query alias and considering enabled session filters
- Specified by:
- filterFragment in interface Joinable
protected abstract String generateDeleteRowString()
protected abstract String generateDeleteString()
protected String generateDetectRowByElementString()
protected String generateDetectRowByIndexString()
protected abstract String generateInsertRowString()
protected SelectFragment generateSelectFragment(String alias, String columnSuffix)
protected String generateSelectRowByIndexString()
protected String generateSelectSizeString(boolean isIntegerIndexed)
protected abstract String generateUpdateRowString()
protected CollectionInitializer getAppropriateInitializer(Serializable key, SessionImplementor session)
public CollectionRegionAccessStrategy getCacheAccessStrategy()
Get the cache
- Specified by:
- getCacheAccessStrategy in interface CollectionPersister
public CacheEntryStructure getCacheEntryStructure()
Get the cache structure
- Specified by:
- getCacheEntryStructure in interface CollectionPersister
public CollectionMetadata getCollectionMetadata()
- Specified by:
- getCollectionMetadata in interface CollectionPersister
public String[] getCollectionPropertyColumnAliases(String propertyName, String suffix)
- Specified by:
- getCollectionPropertyColumnAliases in interface SQLLoadableCollection
public Serializable[] getCollectionSpaces()
Get the "space" that holds the persistent state
- Specified by:
- getCollectionSpaces in interface CollectionPersister
public CollectionType getCollectionType()
Get the associated Type
- Specified by:
- getCollectionType in interface CollectionPersister
public Object getElementByIndex(Serializable key, Object index, SessionImplementor session, Object owner)
- Specified by:
- getElementByIndex in interface CollectionPersister
public Class getElementClass()
Return the element class of an array, or null otherwise
- Specified by:
- getElementClass in interface CollectionPersister
public String[] getElementColumnAliases(String suffix)
Generates the collection's element column aliases, based on the given suffix.
- Specified by:
- getElementColumnAliases in interface CollectionPersister
- Parameters:
suffix
- The suffix to use in the element column alias generation.
- Returns:
- The key column aliases.
public String[] getElementColumnNames()
Get the names of the collection element columns (or the primary key columns in the case of a one-to-many association)
- Specified by:
- getElementColumnNames in interface QueryableCollection
public String[] getElementColumnNames(String alias)
Get the names of the collection element columns (or the primary key columns in the case of a one-to-many association), aliased by the given table alias
- Specified by:
- getElementColumnNames in interface QueryableCollection
public String getElementNodeName()
- Specified by:
- getElementNodeName in interface CollectionPersister
public EntityPersister getElementPersister()
Get the persister of the element class, if this is a collection of entities (optional operation). Note that for a one-to-many association, the returned persister must be OuterJoinLoadable.
- Specified by:
- getElementPersister in interface QueryableCollection
public Type getElementType()
The collection element type
- Specified by:
- getElementType in interface CollectionMetadata
- getElementType in interface CollectionPersister
public SessionFactoryImplementor getFactory()
- Specified by:
- getFactory in interface CollectionPersister
public FetchMode getFetchMode()
Should we load this collection role by outerjoining?
- Specified by:
- getFetchMode in interface QueryableCollection
public String getIdentifierColumnAlias(String suffix)
Generates the collection's identifier column aliases, based on the given suffix.
- Specified by:
- getIdentifierColumnAlias in interface CollectionPersister
- Parameters:
suffix
- The suffix to use in the key column alias generation.
- Returns:
- The key column aliases.
public String getIdentifierColumnName()
- Specified by:
- getIdentifierColumnName in interface SQLLoadableCollection
public IdentifierGenerator getIdentifierGenerator()
Get the surrogate key generation strategy (optional operation)
- Specified by:
- getIdentifierGenerator in interface CollectionPersister
public Type getIdentifierType()
Get the type of the surrogate key
- Specified by:
- getIdentifierType in interface CollectionPersister
public String[] getIndexColumnAliases(String suffix)
Generates the collection's index column aliases, based on the given suffix.
- Specified by:
- getIndexColumnAliases in interface CollectionPersister
- Parameters:
suffix
- The suffix to use in the index column alias generation.
- Returns:
- The key column aliases, or null if not indexed.
public String[] getIndexColumnNames()
Get the names of the collection index columns if this is an indexed collection (optional operation)
- Specified by:
- getIndexColumnNames in interface QueryableCollection
public String[] getIndexColumnNames(String alias)
Get the names of the collection index columns if this is an indexed collection (optional operation), aliased by the given table alias
- Specified by:
- getIndexColumnNames in interface QueryableCollection
public String[] getIndexFormulas()
Get the index formulas if this is an indexed collection (optional operation)
- Specified by:
- getIndexFormulas in interface QueryableCollection
public String getIndexNodeName()
- Specified by:
- getIndexNodeName in interface CollectionPersister
public Type getIndexType()
The collection index type (or null if the collection has no index)
- Specified by:
- getIndexType in interface CollectionMetadata
- getIndexType in interface CollectionPersister
public String[] getKeyColumnAliases(String suffix)
Generates the collection's key column aliases, based on the given suffix.
- Specified by:
- getKeyColumnAliases in interface CollectionPersister
- Parameters:
suffix
- The suffix to use in the key column alias generation.
- Returns:
- The key column aliases.
public String[] getKeyColumnNames()
The columns to join on
- Specified by:
- getKeyColumnNames in interface Joinable
public Type getKeyType()
The collection key type
- Specified by:
- getKeyType in interface CollectionMetadata
- getKeyType in interface CollectionPersister
public String getManyToManyFilterFragment(String alias, Map enabledFilters)
- Specified by:
- getManyToManyFilterFragment in interface CollectionPersister
public String getManyToManyOrderByString(String alias)
Get the order-by to be applied at the target table of a many to many
- Specified by:
- getManyToManyOrderByString in interface QueryableCollection
- Parameters:
alias
- The alias for the many-to-many target table
- Returns:
- appropriate order-by fragment or empty string.
public String getName()
An identifying name; a class name or collection role name.
public String getOwnerEntityName()
public EntityPersister getOwnerEntityPersister()
Get the persister of the entity that "owns" this collection
- Specified by:
- getOwnerEntityPersister in interface CollectionPersister
public String getRole()
The name of this collection role
- Specified by:
- getRole in interface CollectionMetadata
- getRole in interface CollectionPersister
protected String getSQLDeleteRowString()
protected String getSQLDeleteString()
protected String getSQLInsertRowString()
public String getSQLOrderByString(String alias)
Get the order by SQL
- Specified by:
- getSQLOrderByString in interface QueryableCollection
protected String getSQLUpdateRowString()
protected String getSQLWhereString(String alias)
public int getSize(Serializable key, SessionImplementor session)
- Specified by:
- getSize in interface CollectionPersister
public String getTableName()
The table to join to.
- Specified by:
- getTableName in interface Joinable
public Type getType()
Get the type of the thing containing the properties
- Specified by:
- getType in interface PropertyMapping
public boolean hasCache()
Is this collection role cacheable
- Specified by:
- hasCache in interface CollectionPersister
public boolean hasIndex()
Is this collection indexed?
- Specified by:
- hasIndex in interface CollectionMetadata
- hasIndex in interface CollectionPersister
public boolean hasManyToManyOrdering()
- Specified by:
- hasManyToManyOrdering in interface CollectionPersister
public boolean hasOrdering()
Is this an ordered collection? (An ordered collection is ordered by the initialization operation, not by sorting that happens in memory, as in the case of a sorted collection.)
- Specified by:
- hasOrdering in interface CollectionPersister
public boolean hasOrphanDelete()
Does this collection implement "orphan delete"?
- Specified by:
- hasOrphanDelete in interface CollectionPersister
public boolean hasWhere()
Does this collection role have a where clause filter?
- Specified by:
- hasWhere in interface QueryableCollection
protected Object incrementIndexByBase(Object index)
public boolean indexExists(Serializable key, Object index, SessionImplementor session)
- Specified by:
- indexExists in interface CollectionPersister
public void initCollectionPropertyMap()
public void initialize(Serializable key, SessionImplementor session) throws HibernateException
Initialize the given collection with the given key
- Specified by:
- initialize in interface CollectionPersister
public void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws HibernateException
Insert the persistent state of any new collection elements
- Specified by:
- insertRows in interface CollectionPersister
public boolean isAffectedByEnabledFilters(SessionImplementor session)
- Specified by:
- isAffectedByEnabledFilters in interface CollectionPersister
public boolean isArray()
Is the collection an array?
- Specified by:
- isArray in interface CollectionMetadata
- isArray in interface CollectionPersister
public boolean isCollection()
Is this instance actually a CollectionPersister?
- Specified by:
- isCollection in interface Joinable
protected boolean isDeleteAllCallable()
protected boolean isDeleteCallable()
protected boolean isInsertCallable()
public boolean isInverse()
Is this collection "inverse", so state changes are not propogated to the database.
- Specified by:
- isInverse in interface CollectionPersister
public boolean isLazy()
Is the collection lazily initialized?
- Specified by:
- isLazy in interface CollectionMetadata
- isLazy in interface CollectionPersister
public abstract boolean isManyToMany()
Is this a many-to-many association? Note that this is mainly a convenience feature as the single persister does not conatin all the information needed to handle a many-to-many itself, as internally it is looked at as two many-to-ones.
- Specified by:
- isManyToMany in interface CollectionPersister
public boolean isMutable()
Can the elements of this collection change?
- Specified by:
- isMutable in interface CollectionPersister
public boolean isPrimitiveArray()
Is the collection a primitive array?
- Specified by:
- isPrimitiveArray in interface CollectionMetadata
- isPrimitiveArray in interface CollectionPersister
protected boolean isRowDeleteEnabled()
protected boolean isRowInsertEnabled()
public boolean isSubselectLoadable()
protected boolean isUpdateCallable()
public boolean isVersioned()
Does this collection cause version increment of the owning entity?
- Specified by:
- isVersioned in interface CollectionPersister
protected void logStaticSQL()
public String oneToManyFilterFragment(String alias) throws MappingException
- Specified by:
- oneToManyFilterFragment in interface Joinable
public void postInstantiate() throws MappingException
- Specified by:
- postInstantiate in interface CollectionPersister
public Object readElement(ResultSet rs, Object owner, String[] aliases, SessionImplementor session) throws HibernateException, SQLException
Read the element from a row of the JDBC ResultSet
- Specified by:
- readElement in interface CollectionPersister
public Object readIdentifier(ResultSet rs, String alias, SessionImplementor session) throws HibernateException, SQLException
Read the identifier from a row of the JDBC ResultSet
- Specified by:
- readIdentifier in interface CollectionPersister
public Object readIndex(ResultSet rs, String[] aliases, SessionImplementor session) throws HibernateException, SQLException
Read the index from a row of the JDBC ResultSet
- Specified by:
- readIndex in interface CollectionPersister
public Object readKey(ResultSet rs, String[] aliases, SessionImplementor session) throws HibernateException, SQLException
Read the key from a row of the JDBC ResultSet
- Specified by:
- readKey in interface CollectionPersister
public void recreate(PersistentCollection collection, Serializable id, SessionImplementor session) throws HibernateException
(Re)create the collection's persistent state
- Specified by:
- recreate in interface CollectionPersister
public void remove(Serializable id, SessionImplementor session) throws HibernateException
Completely remove the persistent state of the collection
- Specified by:
- remove in interface CollectionPersister
public String selectFragment(String alias, String columnSuffix)
Generate a list of collection index, key and element columns
- Specified by:
- selectFragment in interface QueryableCollection
public String[] toColumns(String propertyName) throws QueryException
Given a property path, return the corresponding column name(s).
- Specified by:
- toColumns in interface PropertyMapping
public String[] toColumns(String alias, String propertyName) throws QueryException
Given a query alias and a property path, return the qualified column name
- Specified by:
- toColumns in interface PropertyMapping
public String toString()
public Type toType(String propertyName) throws QueryException
Given a component path expression, get the type of the property
- Specified by:
- toType in interface PropertyMapping
public void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws HibernateException
Update the persistent state of any elements that were modified
- Specified by:
- updateRows in interface CollectionPersister
protected int writeElement(PreparedStatement st, Object elt, int i, SessionImplementor session) throws HibernateException, SQLException
Write the element to a JDBC PreparedStatement
protected int writeElementToWhere(PreparedStatement st, Object elt, int i, SessionImplementor session) throws HibernateException, SQLException
Write the element to a JDBC PreparedStatement
public int writeIdentifier(PreparedStatement st, Object id, int i, SessionImplementor session) throws HibernateException, SQLException
Write the identifier to a JDBC PreparedStatement
protected int writeIndex(PreparedStatement st, Object index, int i, SessionImplementor session) throws HibernateException, SQLException
Write the index to a JDBC PreparedStatement
protected int writeIndexToWhere(PreparedStatement st, Object index, int i, SessionImplementor session) throws HibernateException, SQLException
Write the index to a JDBC PreparedStatement
protected int writeKey(PreparedStatement st, Serializable key, int i, SessionImplementor session) throws HibernateException, SQLException
Write the key to a JDBC PreparedStatement