org.hibernate.persister.collection
Class AbstractCollectionPersister

java.lang.Object
  extended by org.hibernate.persister.collection.AbstractCollectionPersister
All Implemented Interfaces:
CollectionMetadata, CollectionPersister, QueryableCollection, SQLLoadableCollection, Joinable, PropertyMapping
Direct Known Subclasses:
BasicCollectionPersister, OneToManyPersister

public abstract class AbstractCollectionPersister
extends Object
implements CollectionMetadata, SQLLoadableCollection

Base implementation of the QueryableCollection interface.

Author:
Gavin King
See Also:
BasicCollectionPersister, OneToManyPersister

Field Summary
protected  int batchSize
           
protected  String[] elementColumnAliases
           
protected  boolean[] elementColumnIsInPrimaryKey
           
protected  boolean[] elementColumnIsSettable
           
protected  String[] elementColumnNames
           
protected  String[] elementColumnReaders
           
protected  String[] elementColumnReaderTemplates
           
protected  String[] elementColumnWriters
           
protected  String[] elementFormulas
           
protected  String[] elementFormulaTemplates
           
protected  boolean elementIsPureFormula
           
protected  Type elementType
           
protected  boolean hasIdentifier
           
protected  boolean hasIndex
           
protected  boolean hasWhere
           
protected  String identifierColumnName
           
protected  String[] indexColumnAliases
           
protected  boolean[] indexColumnIsSettable
           
protected  String[] indexColumnNames
           
protected  boolean indexContainsFormula
           
protected  String[] indexFormulas
           
protected  String[] indexFormulaTemplates
           
protected  String[] keyColumnAliases
           
protected  String[] keyColumnNames
           
protected  String qualifiedTableName
           
protected  String sqlWhereString
           
 
Constructor Summary
AbstractCollectionPersister(Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory)
           
 
Method Summary
protected  void appendElementColumns(SelectFragment frag, String elemAlias)
           
protected  void appendIdentifierColumns(SelectFragment frag, String alias)
           
protected  void appendIndexColumns(SelectFragment frag, String alias)
           
protected abstract  CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
           
protected abstract  CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session)
           
protected  Object decrementIndexByBase(Object index)
           
 void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session)
          Delete the persistent state of any elements that were removed from the collection
protected abstract  int doUpdateRows(Serializable key, PersistentCollection collection, SessionImplementor session)
           
 boolean elementExists(Serializable key, Object element, SessionImplementor session)
           
protected  String filterFragment(String alias)
           
 String filterFragment(String alias, Map enabledFilters)
          Get the where clause filter, given a query alias and considering enabled session filters
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)
           
 CollectionRegionAccessStrategy getCacheAccessStrategy()
          Get the cache
 CacheEntryStructure getCacheEntryStructure()
          Get the cache structure
 CollectionMetadata getCollectionMetadata()
           
 String[] getCollectionPropertyColumnAliases(String propertyName, String suffix)
           
 Serializable[] getCollectionSpaces()
          Get the "space" that holds the persistent state
 CollectionType getCollectionType()
          Get the associated Type
protected  ExecuteUpdateResultCheckStyle getDeleteAllCheckStyle()
           
protected  ExecuteUpdateResultCheckStyle getDeleteCheckStyle()
           
protected  Dialect getDialect()
           
 Object getElementByIndex(Serializable key, Object index, SessionImplementor session, Object owner)
           
 Class getElementClass()
          Return the element class of an array, or null otherwise
 String[] getElementColumnAliases(String suffix)
          Generates the collection's element column aliases, based on the given suffix.
 String[] getElementColumnNames()
          Get the names of the collection element columns (or the primary key columns in the case of a one-to-many association)
 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
 String getElementNodeName()
           
 EntityPersister getElementPersister()
          Get the persister of the element class, if this is a collection of entities (optional operation).
 Type getElementType()
          The collection element type
 SessionFactoryImplementor getFactory()
           
 FetchMode getFetchMode()
          Should we load this collection role by outerjoining?
 String getIdentifierColumnAlias(String suffix)
          Generates the collection's identifier column aliases, based on the given suffix.
 String getIdentifierColumnName()
           
 IdentifierGenerator getIdentifierGenerator()
          Get the surrogate key generation strategy (optional operation)
 Type getIdentifierType()
          Get the type of the surrogate key
 String[] getIndexColumnAliases(String suffix)
          Generates the collection's index column aliases, based on the given suffix.
 String[] getIndexColumnNames()
          Get the names of the collection index columns if this is an indexed collection (optional operation)
 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
 String[] getIndexFormulas()
          Get the index formulas if this is an indexed collection (optional operation)
 String getIndexNodeName()
           
 Type getIndexType()
          The collection index type (or null if the collection has no index)
 CollectionInitializer getInitializer()
          Intended for internal use only.
protected  ExecuteUpdateResultCheckStyle getInsertCheckStyle()
           
 String[] getKeyColumnAliases(String suffix)
          Generates the collection's key column aliases, based on the given suffix.
 String[] getKeyColumnNames()
          The columns to join on
 Type getKeyType()
          The collection key type
 String getManyToManyFilterFragment(String alias, Map enabledFilters)
           
 String getManyToManyOrderByString(String alias)
          Get the order-by to be applied at the target table of a many to many
 String getName()
          An identifying name; a class name or collection role name.
 String getNodeName()
           
 String getOwnerEntityName()
           
 EntityPersister getOwnerEntityPersister()
          Get the persister of the entity that "owns" this collection
 String getRole()
          The name of this collection role
 int getSize(Serializable key, SessionImplementor session)
           
protected  String getSQLDeleteRowString()
           
protected  String getSQLDeleteString()
           
protected  SQLExceptionConverter getSQLExceptionConverter()
           
protected  String getSQLInsertRowString()
           
 String getSQLOrderByString(String alias)
          Get the order by SQL
protected  String getSQLUpdateRowString()
           
protected  String getSQLWhereString(String alias)
           
 String getTableName()
          The table to join to.
 Type getType()
          Get the type of the thing containing the properties
protected  ExecuteUpdateResultCheckStyle getUpdateCheckStyle()
           
 boolean hasCache()
          Is this collection role cacheable
 boolean hasIndex()
          Is this collection indexed?
 boolean hasManyToManyOrdering()
           
 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.)
 boolean hasOrphanDelete()
          Does this collection implement "orphan delete"?
 boolean hasWhere()
          Does this collection role have a where clause filter?
protected  Object incrementIndexByBase(Object index)
           
 boolean indexExists(Serializable key, Object index, SessionImplementor session)
           
 void initCollectionPropertyMap()
           
 void initialize(Serializable key, SessionImplementor session)
          Initialize the given collection with the given key
 void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session)
          Insert the persistent state of any new collection elements
 boolean isAffectedByEnabledFilters(SessionImplementor session)
           
 boolean isArray()
          Is the collection an array?
 boolean isCollection()
          Is this instance actually a CollectionPersister?
protected  boolean isDeleteAllCallable()
           
protected  boolean isDeleteCallable()
           
 boolean isExtraLazy()
           
protected  boolean isInsertCallable()
           
 boolean isInverse()
          Is this collection "inverse", so state changes are not propogated to the database.
 boolean isLazy()
          Is the collection lazily initialized?
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.
 boolean isMutable()
          Can the elements of this collection change?
 boolean isPrimitiveArray()
          Is the collection a primitive array?
protected  boolean isRowDeleteEnabled()
           
protected  boolean isRowInsertEnabled()
           
 boolean isSubselectLoadable()
           
protected  boolean isUpdateCallable()
           
 boolean isVersioned()
          Does this collection cause version increment of the owning entity?
protected  void logStaticSQL()
           
 String oneToManyFilterFragment(String alias)
           
 void postInstantiate()
           
 Object readElement(ResultSet rs, Object owner, String[] aliases, SessionImplementor session)
          Read the element from a row of the JDBC ResultSet
 Object readIdentifier(ResultSet rs, String alias, SessionImplementor session)
          Read the identifier from a row of the JDBC ResultSet
 Object readIndex(ResultSet rs, String[] aliases, SessionImplementor session)
          Read the index from a row of the JDBC ResultSet
 Object readKey(ResultSet rs, String[] aliases, SessionImplementor session)
          Read the key from a row of the JDBC ResultSet
 void recreate(PersistentCollection collection, Serializable id, SessionImplementor session)
          (Re)create the collection's persistent state
 void remove(Serializable id, SessionImplementor session)
          Completely remove the persistent state of the collection
 String selectFragment(String alias, String columnSuffix)
          Generate a list of collection index, key and element columns
 String[] toColumns(String propertyName)
          Given a property path, return the corresponding column name(s).
 String[] toColumns(String alias, String propertyName)
          Given a query alias and a property path, return the qualified column name
 String toString()
           
 Type toType(String propertyName)
          Given a component path expression, get the type of the property
 void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session)
          Update the persistent state of any elements that were modified
protected  int writeElement(PreparedStatement st, Object elt, int i, SessionImplementor session)
          Write the element to a JDBC PreparedStatement
protected  int writeElementToWhere(PreparedStatement st, Object elt, int i, SessionImplementor session)
          Write the element to a JDBC PreparedStatement
 int writeIdentifier(PreparedStatement st, Object id, int i, SessionImplementor session)
          Write the identifier to a JDBC PreparedStatement
protected  int writeIndex(PreparedStatement st, Object index, int i, SessionImplementor session)
          Write the index to a JDBC PreparedStatement
protected  int writeIndexToWhere(PreparedStatement st, Object index, int i, SessionImplementor session)
          Write the index to a JDBC PreparedStatement
protected  int writeKey(PreparedStatement st, Serializable key, int i, SessionImplementor session)
          Write the key to a JDBC PreparedStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.hibernate.persister.entity.Joinable
consumesCollectionAlias, consumesEntityAlias, fromJoinFragment, selectFragment, whereJoinFragment
 
Methods inherited from interface org.hibernate.persister.collection.CollectionPersister
isCascadeDeleteEnabled, isOneToMany
 

Field Detail

sqlWhereString

protected final String sqlWhereString

hasWhere

protected final boolean hasWhere

indexContainsFormula

protected final boolean indexContainsFormula

elementIsPureFormula

protected final boolean elementIsPureFormula

elementType

protected final Type elementType

keyColumnNames

protected final String[] keyColumnNames

indexColumnNames

protected final String[] indexColumnNames

indexFormulaTemplates

protected final String[] indexFormulaTemplates

indexFormulas

protected final String[] indexFormulas

indexColumnIsSettable

protected final boolean[] indexColumnIsSettable

elementColumnNames

protected final String[] elementColumnNames

elementColumnWriters

protected final String[] elementColumnWriters

elementColumnReaders

protected final String[] elementColumnReaders

elementColumnReaderTemplates

protected final String[] elementColumnReaderTemplates

elementFormulaTemplates

protected final String[] elementFormulaTemplates

elementFormulas

protected final String[] elementFormulas

elementColumnIsSettable

protected final boolean[] elementColumnIsSettable

elementColumnIsInPrimaryKey

protected final boolean[] elementColumnIsInPrimaryKey

indexColumnAliases

protected final String[] indexColumnAliases

elementColumnAliases

protected final String[] elementColumnAliases

keyColumnAliases

protected final String[] keyColumnAliases

identifierColumnName

protected final String identifierColumnName

qualifiedTableName

protected final String qualifiedTableName

hasIndex

protected final boolean hasIndex

hasIdentifier

protected final boolean hasIdentifier

batchSize

protected final int batchSize
Constructor Detail

AbstractCollectionPersister

public AbstractCollectionPersister(Collection collection,
                                   CollectionRegionAccessStrategy cacheAccessStrategy,
                                   Configuration cfg,
                                   SessionFactoryImplementor factory)
                            throws MappingException,
                                   CacheException
Throws:
MappingException
CacheException
Method Detail

postInstantiate

public void postInstantiate()
                     throws MappingException
Specified by:
postInstantiate in interface CollectionPersister
Throws:
MappingException

logStaticSQL

protected void logStaticSQL()

initialize

public void initialize(Serializable key,
                       SessionImplementor session)
                throws HibernateException
Description copied from interface: CollectionPersister
Initialize the given collection with the given key

Specified by:
initialize in interface CollectionPersister
Throws:
HibernateException

getAppropriateInitializer

protected CollectionInitializer getAppropriateInitializer(Serializable key,
                                                          SessionImplementor session)

createSubselectInitializer

protected abstract CollectionInitializer createSubselectInitializer(SubselectFetch subselect,
                                                                    SessionImplementor session)

createCollectionInitializer

protected abstract CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
                                                              throws MappingException
Throws:
MappingException

getCacheAccessStrategy

public CollectionRegionAccessStrategy getCacheAccessStrategy()
Description copied from interface: CollectionPersister
Get the cache

Specified by:
getCacheAccessStrategy in interface CollectionPersister

hasCache

public boolean hasCache()
Description copied from interface: CollectionPersister
Is this collection role cacheable

Specified by:
hasCache in interface CollectionPersister

getCollectionType

public CollectionType getCollectionType()
Description copied from interface: CollectionPersister
Get the associated Type

Specified by:
getCollectionType in interface CollectionPersister

getSQLWhereString

protected String getSQLWhereString(String alias)

getSQLOrderByString

public String getSQLOrderByString(String alias)
Description copied from interface: QueryableCollection
Get the order by SQL

Specified by:
getSQLOrderByString in interface QueryableCollection

getManyToManyOrderByString

public String getManyToManyOrderByString(String alias)
Description copied from interface: QueryableCollection
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.

getFetchMode

public FetchMode getFetchMode()
Description copied from interface: QueryableCollection
Should we load this collection role by outerjoining?

Specified by:
getFetchMode in interface QueryableCollection

hasOrdering

public boolean hasOrdering()
Description copied from interface: CollectionPersister
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

hasManyToManyOrdering

public boolean hasManyToManyOrdering()
Specified by:
hasManyToManyOrdering in interface CollectionPersister

hasWhere

public boolean hasWhere()
Description copied from interface: QueryableCollection
Does this collection role have a where clause filter?

Specified by:
hasWhere in interface QueryableCollection

getSQLDeleteString

protected String getSQLDeleteString()

getSQLInsertRowString

protected String getSQLInsertRowString()

getSQLUpdateRowString

protected String getSQLUpdateRowString()

getSQLDeleteRowString

protected String getSQLDeleteRowString()

getKeyType

public Type getKeyType()
Description copied from interface: CollectionMetadata
The collection key type

Specified by:
getKeyType in interface CollectionMetadata
Specified by:
getKeyType in interface CollectionPersister

getIndexType

public Type getIndexType()
Description copied from interface: CollectionMetadata
The collection index type (or null if the collection has no index)

Specified by:
getIndexType in interface CollectionMetadata
Specified by:
getIndexType in interface CollectionPersister

getElementType

public Type getElementType()
Description copied from interface: CollectionMetadata
The collection element type

Specified by:
getElementType in interface CollectionMetadata
Specified by:
getElementType in interface CollectionPersister

getElementClass

public Class getElementClass()
Return the element class of an array, or null otherwise

Specified by:
getElementClass in interface CollectionPersister

readElement

public Object readElement(ResultSet rs,
                          Object owner,
                          String[] aliases,
                          SessionImplementor session)
                   throws HibernateException,
                          SQLException
Description copied from interface: CollectionPersister
Read the element from a row of the JDBC ResultSet

Specified by:
readElement in interface CollectionPersister
Throws:
HibernateException
SQLException

readIndex

public Object readIndex(ResultSet rs,
                        String[] aliases,
                        SessionImplementor session)
                 throws HibernateException,
                        SQLException
Description copied from interface: CollectionPersister
Read the index from a row of the JDBC ResultSet

Specified by:
readIndex in interface CollectionPersister
Throws:
HibernateException
SQLException

decrementIndexByBase

protected Object decrementIndexByBase(Object index)

readIdentifier

public Object readIdentifier(ResultSet rs,
                             String alias,
                             SessionImplementor session)
                      throws HibernateException,
                             SQLException
Description copied from interface: CollectionPersister
Read the identifier from a row of the JDBC ResultSet

Specified by:
readIdentifier in interface CollectionPersister
Throws:
HibernateException
SQLException

readKey

public Object readKey(ResultSet rs,
                      String[] aliases,
                      SessionImplementor session)
               throws HibernateException,
                      SQLException
Description copied from interface: CollectionPersister
Read the key from a row of the JDBC ResultSet

Specified by:
readKey in interface CollectionPersister
Throws:
HibernateException
SQLException

writeKey

protected int writeKey(PreparedStatement st,
                       Serializable key,
                       int i,
                       SessionImplementor session)
                throws HibernateException,
                       SQLException
Write the key to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

writeElement

protected int writeElement(PreparedStatement st,
                           Object elt,
                           int i,
                           SessionImplementor session)
                    throws HibernateException,
                           SQLException
Write the element to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

writeIndex

protected int writeIndex(PreparedStatement st,
                         Object index,
                         int i,
                         SessionImplementor session)
                  throws HibernateException,
                         SQLException
Write the index to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

incrementIndexByBase

protected Object incrementIndexByBase(Object index)

writeElementToWhere

protected int writeElementToWhere(PreparedStatement st,
                                  Object elt,
                                  int i,
                                  SessionImplementor session)
                           throws HibernateException,
                                  SQLException
Write the element to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

writeIndexToWhere

protected int writeIndexToWhere(PreparedStatement st,
                                Object index,
                                int i,
                                SessionImplementor session)
                         throws HibernateException,
                                SQLException
Write the index to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

writeIdentifier

public int writeIdentifier(PreparedStatement st,
                           Object id,
                           int i,
                           SessionImplementor session)
                    throws HibernateException,
                           SQLException
Write the identifier to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

isPrimitiveArray

public boolean isPrimitiveArray()
Description copied from interface: CollectionMetadata
Is the collection a primitive array?

Specified by:
isPrimitiveArray in interface CollectionMetadata
Specified by:
isPrimitiveArray in interface CollectionPersister

isArray

public boolean isArray()
Description copied from interface: CollectionMetadata
Is the collection an array?

Specified by:
isArray in interface CollectionMetadata
Specified by:
isArray in interface CollectionPersister

getKeyColumnAliases

public String[] getKeyColumnAliases(String suffix)
Description copied from interface: CollectionPersister
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.

getElementColumnAliases

public String[] getElementColumnAliases(String suffix)
Description copied from interface: CollectionPersister
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.

getIndexColumnAliases

public String[] getIndexColumnAliases(String suffix)
Description copied from interface: CollectionPersister
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.

getIdentifierColumnAlias

public String getIdentifierColumnAlias(String suffix)
Description copied from interface: CollectionPersister
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.

getIdentifierColumnName

public String getIdentifierColumnName()
Specified by:
getIdentifierColumnName in interface SQLLoadableCollection

selectFragment

public String selectFragment(String alias,
                             String columnSuffix)
Generate a list of collection index, key and element columns

Specified by:
selectFragment in interface QueryableCollection

generateSelectSizeString

protected String generateSelectSizeString(boolean isIntegerIndexed)

generateDetectRowByIndexString

protected String generateDetectRowByIndexString()

generateSelectRowByIndexString

protected String generateSelectRowByIndexString()

generateDetectRowByElementString

protected String generateDetectRowByElementString()

generateSelectFragment

protected SelectFragment generateSelectFragment(String alias,
                                                String columnSuffix)

appendElementColumns

protected void appendElementColumns(SelectFragment frag,
                                    String elemAlias)

appendIndexColumns

protected void appendIndexColumns(SelectFragment frag,
                                  String alias)

appendIdentifierColumns

protected void appendIdentifierColumns(SelectFragment frag,
                                       String alias)

getIndexColumnNames

public String[] getIndexColumnNames()
Description copied from interface: QueryableCollection
Get the names of the collection index columns if this is an indexed collection (optional operation)

Specified by:
getIndexColumnNames in interface QueryableCollection

getIndexFormulas

public String[] getIndexFormulas()
Description copied from interface: QueryableCollection
Get the index formulas if this is an indexed collection (optional operation)

Specified by:
getIndexFormulas in interface QueryableCollection

getIndexColumnNames

public String[] getIndexColumnNames(String alias)
Description copied from interface: QueryableCollection
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

getElementColumnNames

public String[] getElementColumnNames(String alias)
Description copied from interface: QueryableCollection
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

getElementColumnNames

public String[] getElementColumnNames()
Description copied from interface: QueryableCollection
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

getKeyColumnNames

public String[] getKeyColumnNames()
Description copied from interface: Joinable
The columns to join on

Specified by:
getKeyColumnNames in interface Joinable

hasIndex

public boolean hasIndex()
Description copied from interface: CollectionMetadata
Is this collection indexed?

Specified by:
hasIndex in interface CollectionMetadata
Specified by:
hasIndex in interface CollectionPersister

isLazy

public boolean isLazy()
Description copied from interface: CollectionMetadata
Is the collection lazily initialized?

Specified by:
isLazy in interface CollectionMetadata
Specified by:
isLazy in interface CollectionPersister

isInverse

public boolean isInverse()
Description copied from interface: CollectionPersister
Is this collection "inverse", so state changes are not propogated to the database.

Specified by:
isInverse in interface CollectionPersister

getTableName

public String getTableName()
Description copied from interface: Joinable
The table to join to.

Specified by:
getTableName in interface Joinable

remove

public void remove(Serializable id,
                   SessionImplementor session)
            throws HibernateException
Description copied from interface: CollectionPersister
Completely remove the persistent state of the collection

Specified by:
remove in interface CollectionPersister
Throws:
HibernateException

recreate

public void recreate(PersistentCollection collection,
                     Serializable id,
                     SessionImplementor session)
              throws HibernateException
Description copied from interface: CollectionPersister
(Re)create the collection's persistent state

Specified by:
recreate in interface CollectionPersister
Throws:
HibernateException

isRowDeleteEnabled

protected boolean isRowDeleteEnabled()

deleteRows

public void deleteRows(PersistentCollection collection,
                       Serializable id,
                       SessionImplementor session)
                throws HibernateException
Description copied from interface: CollectionPersister
Delete the persistent state of any elements that were removed from the collection

Specified by:
deleteRows in interface CollectionPersister
Throws:
HibernateException

isRowInsertEnabled

protected boolean isRowInsertEnabled()

insertRows

public void insertRows(PersistentCollection collection,
                       Serializable id,
                       SessionImplementor session)
                throws HibernateException
Description copied from interface: CollectionPersister
Insert the persistent state of any new collection elements

Specified by:
insertRows in interface CollectionPersister
Throws:
HibernateException

getRole

public String getRole()
Description copied from interface: CollectionMetadata
The name of this collection role

Specified by:
getRole in interface CollectionMetadata
Specified by:
getRole in interface CollectionPersister

getOwnerEntityName

public String getOwnerEntityName()

getOwnerEntityPersister

public EntityPersister getOwnerEntityPersister()
Description copied from interface: CollectionPersister
Get the persister of the entity that "owns" this collection

Specified by:
getOwnerEntityPersister in interface CollectionPersister

getIdentifierGenerator

public IdentifierGenerator getIdentifierGenerator()
Description copied from interface: CollectionPersister
Get the surrogate key generation strategy (optional operation)

Specified by:
getIdentifierGenerator in interface CollectionPersister

getIdentifierType

public Type getIdentifierType()
Description copied from interface: CollectionPersister
Get the type of the surrogate key

Specified by:
getIdentifierType in interface CollectionPersister

hasOrphanDelete

public boolean hasOrphanDelete()
Description copied from interface: CollectionPersister
Does this collection implement "orphan delete"?

Specified by:
hasOrphanDelete in interface CollectionPersister

toType

public Type toType(String propertyName)
            throws QueryException
Description copied from interface: PropertyMapping
Given a component path expression, get the type of the property

Specified by:
toType in interface PropertyMapping
Throws:
QueryException

isManyToMany

public abstract boolean isManyToMany()
Description copied from interface: CollectionPersister
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

getManyToManyFilterFragment

public String getManyToManyFilterFragment(String alias,
                                          Map enabledFilters)
Specified by:
getManyToManyFilterFragment in interface CollectionPersister

toColumns

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
Throws:
QueryException

toColumns

public String[] toColumns(String propertyName)
                   throws QueryException
Given a property path, return the corresponding column name(s).

Specified by:
toColumns in interface PropertyMapping
Throws:
QueryException

getType

public Type getType()
Description copied from interface: PropertyMapping
Get the type of the thing containing the properties

Specified by:
getType in interface PropertyMapping

getName

public String getName()
Description copied from interface: Joinable
An identifying name; a class name or collection role name.

Specified by:
getName in interface Joinable

getElementPersister

public EntityPersister getElementPersister()
Description copied from interface: QueryableCollection
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

isCollection

public boolean isCollection()
Description copied from interface: Joinable
Is this instance actually a CollectionPersister?

Specified by:
isCollection in interface Joinable

getCollectionSpaces

public Serializable[] getCollectionSpaces()
Description copied from interface: CollectionPersister
Get the "space" that holds the persistent state

Specified by:
getCollectionSpaces in interface CollectionPersister

generateDeleteString

protected abstract String generateDeleteString()

generateDeleteRowString

protected abstract String generateDeleteRowString()

generateUpdateRowString

protected abstract String generateUpdateRowString()

generateInsertRowString

protected abstract String generateInsertRowString()

updateRows

public void updateRows(PersistentCollection collection,
                       Serializable id,
                       SessionImplementor session)
                throws HibernateException
Description copied from interface: CollectionPersister
Update the persistent state of any elements that were modified

Specified by:
updateRows in interface CollectionPersister
Throws:
HibernateException

doUpdateRows

protected abstract int doUpdateRows(Serializable key,
                                    PersistentCollection collection,
                                    SessionImplementor session)
                             throws HibernateException
Throws:
HibernateException

getCollectionMetadata

public CollectionMetadata getCollectionMetadata()
Specified by:
getCollectionMetadata in interface CollectionPersister

getFactory

public SessionFactoryImplementor getFactory()
Specified by:
getFactory in interface CollectionPersister

filterFragment

protected String filterFragment(String alias)
                         throws MappingException
Throws:
MappingException

filterFragment

public String filterFragment(String alias,
                             Map enabledFilters)
                      throws MappingException
Description copied from interface: Joinable
Get the where clause filter, given a query alias and considering enabled session filters

Specified by:
filterFragment in interface Joinable
Throws:
MappingException

oneToManyFilterFragment

public String oneToManyFilterFragment(String alias)
                               throws MappingException
Specified by:
oneToManyFilterFragment in interface Joinable
Throws:
MappingException

isInsertCallable

protected boolean isInsertCallable()

getInsertCheckStyle

protected ExecuteUpdateResultCheckStyle getInsertCheckStyle()

isUpdateCallable

protected boolean isUpdateCallable()

getUpdateCheckStyle

protected ExecuteUpdateResultCheckStyle getUpdateCheckStyle()

isDeleteCallable

protected boolean isDeleteCallable()

getDeleteCheckStyle

protected ExecuteUpdateResultCheckStyle getDeleteCheckStyle()

isDeleteAllCallable

protected boolean isDeleteAllCallable()

getDeleteAllCheckStyle

protected ExecuteUpdateResultCheckStyle getDeleteAllCheckStyle()

toString

public String toString()
Overrides:
toString in class Object

isVersioned

public boolean isVersioned()
Description copied from interface: CollectionPersister
Does this collection cause version increment of the owning entity?

Specified by:
isVersioned in interface CollectionPersister

getNodeName

public String getNodeName()
Specified by:
getNodeName in interface CollectionPersister

getElementNodeName

public String getElementNodeName()
Specified by:
getElementNodeName in interface CollectionPersister

getIndexNodeName

public String getIndexNodeName()
Specified by:
getIndexNodeName in interface CollectionPersister

getSQLExceptionConverter

protected SQLExceptionConverter getSQLExceptionConverter()

getCacheEntryStructure

public CacheEntryStructure getCacheEntryStructure()
Description copied from interface: CollectionPersister
Get the cache structure

Specified by:
getCacheEntryStructure in interface CollectionPersister

isAffectedByEnabledFilters

public boolean isAffectedByEnabledFilters(SessionImplementor session)
Specified by:
isAffectedByEnabledFilters in interface CollectionPersister

isSubselectLoadable

public boolean isSubselectLoadable()

isMutable

public boolean isMutable()
Description copied from interface: CollectionPersister
Can the elements of this collection change?

Specified by:
isMutable in interface CollectionPersister

getCollectionPropertyColumnAliases

public String[] getCollectionPropertyColumnAliases(String propertyName,
                                                   String suffix)
Specified by:
getCollectionPropertyColumnAliases in interface SQLLoadableCollection

initCollectionPropertyMap

public void initCollectionPropertyMap()

getSize

public int getSize(Serializable key,
                   SessionImplementor session)
Specified by:
getSize in interface CollectionPersister

indexExists

public boolean indexExists(Serializable key,
                           Object index,
                           SessionImplementor session)
Specified by:
indexExists in interface CollectionPersister

elementExists

public boolean elementExists(Serializable key,
                             Object element,
                             SessionImplementor session)
Specified by:
elementExists in interface CollectionPersister

getElementByIndex

public Object getElementByIndex(Serializable key,
                                Object index,
                                SessionImplementor session,
                                Object owner)
Specified by:
getElementByIndex in interface CollectionPersister

isExtraLazy

public boolean isExtraLazy()
Specified by:
isExtraLazy in interface CollectionPersister

getDialect

protected Dialect getDialect()

getInitializer

public CollectionInitializer getInitializer()
Intended for internal use only. In fact really only currently used from test suite for assertion purposes.

Returns:
The default collection initializer for this persister/collection.


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.