Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hibernate.persister.collection
Class AbstractCollectionPersister  view AbstractCollectionPersister download AbstractCollectionPersister.java

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

public abstract class AbstractCollectionPersister
extends java.lang.Object
implements org.hibernate.metadata.CollectionMetadata, SQLLoadableCollection

Base implementation of the QueryableCollection interface.


Field Summary
private  int baseIndex
           
protected  int batchSize
           
private  org.hibernate.cache.CacheConcurrencyStrategy cache
           
private  org.hibernate.cache.entry.CacheEntryStructure cacheEntryStructure
           
private  java.util.Map collectionPropertyColumnAliases
           
private  java.util.Map collectionPropertyColumnNames
           
private  org.hibernate.type.CollectionType collectionType
           
private  boolean deleteAllCallable
           
private  boolean deleteCallable
           
private  org.hibernate.dialect.Dialect dialect
           
private  java.lang.Class elementClass
           
protected  java.lang.String[] elementColumnAliases
           
protected  boolean[] elementColumnIsInPrimaryKey
           
protected  boolean[] elementColumnIsSettable
           
protected  java.lang.String[] elementColumnNames
           
protected  java.lang.String[] elementFormulas
           
protected  java.lang.String[] elementFormulaTemplates
           
protected  boolean elementIsPureFormula
           
private  java.lang.String elementNodeName
           
private  org.hibernate.persister.entity.EntityPersister elementPersister
           
private  org.hibernate.persister.entity.PropertyMapping elementPropertyMapping
           
protected  org.hibernate.type.Type elementType
           
private  java.lang.String entityName
           
private  org.hibernate.engine.SessionFactoryImplementor factory
           
private  org.hibernate.FetchMode fetchMode
           
private  org.hibernate.util.FilterHelper filterHelper
           
protected  boolean hasIdentifier
           
protected  boolean hasIndex
           
private  boolean hasOrder
           
private  boolean hasOrphanDelete
           
protected  boolean hasWhere
           
private  java.lang.String identifierColumnAlias
           
protected  java.lang.String identifierColumnName
           
private  org.hibernate.id.IdentifierGenerator identifierGenerator
           
private  org.hibernate.type.Type identifierType
           
protected  java.lang.String[] indexColumnAliases
           
protected  boolean[] indexColumnIsSettable
           
protected  java.lang.String[] indexColumnNames
           
protected  boolean indexContainsFormula
           
protected  java.lang.String[] indexFormulas
           
protected  java.lang.String[] indexFormulaTemplates
           
private  java.lang.String indexNodeName
           
private  org.hibernate.type.Type indexType
           
private  org.hibernate.loader.collection.CollectionInitializer initializer
           
private  boolean insertCallable
           
private  boolean isArray
           
private  boolean isExtraLazy
           
private  boolean isInverse
           
private  boolean isLazy
           
private  boolean isMutable
           
private  boolean isPrimitiveArray
           
private  boolean isVersioned
           
protected  java.lang.String[] keyColumnAliases
           
protected  java.lang.String[] keyColumnNames
           
private  org.hibernate.type.Type keyType
           
private static org.apache.commons.logging.Log log
           
private  org.hibernate.util.FilterHelper manyToManyFilterHelper
           
private  java.lang.String manyToManyOrderByString
           
private  java.lang.String manyToManyOrderByTemplate
           
private  java.lang.String manyToManyWhereString
           
private  java.lang.String manyToManyWhereTemplate
           
private  java.lang.String nodeName
           
private  org.hibernate.persister.entity.EntityPersister ownerPersister
           
protected  java.lang.String qualifiedTableName
           
private  java.lang.String queryLoaderName
           
private  java.lang.String role
           
private  java.io.Serializable[] spaces
           
private  java.lang.String sqlDeleteRowString
           
private  java.lang.String sqlDeleteString
           
private  java.lang.String sqlDetectRowByElementString
           
private  java.lang.String sqlDetectRowByIndexString
           
private  org.hibernate.exception.SQLExceptionConverter sqlExceptionConverter
           
private  java.lang.String sqlInsertRowString
           
private  java.lang.String sqlOrderByString
           
private  java.lang.String sqlOrderByStringTemplate
           
private  java.lang.String sqlSelectRowByIndexString
           
private  java.lang.String sqlSelectSizeString
           
private  java.lang.String sqlUpdateRowString
           
protected  java.lang.String sqlWhereString
           
private  java.lang.String sqlWhereStringTemplate
           
private  boolean subselectLoadable
           
private  boolean updateCallable
           
 
Constructor Summary
AbstractCollectionPersister(org.hibernate.mapping.Collection collection, org.hibernate.cache.CacheConcurrencyStrategy cache, org.hibernate.cfg.Configuration cfg, org.hibernate.engine.SessionFactoryImplementor factory)
           
 
Method Summary
protected  void appendElementColumns(org.hibernate.sql.SelectFragment frag, java.lang.String elemAlias)
           
protected  void appendIdentifierColumns(org.hibernate.sql.SelectFragment frag, java.lang.String alias)
           
protected  void appendIndexColumns(org.hibernate.sql.SelectFragment frag, java.lang.String alias)
           
protected abstract  org.hibernate.loader.collection.CollectionInitializer createCollectionInitializer(java.util.Map enabledFilters)
           
protected abstract  org.hibernate.loader.collection.CollectionInitializer createSubselectInitializer(org.hibernate.engine.SubselectFetch subselect, org.hibernate.engine.SessionImplementor session)
           
protected  java.lang.Object decrementIndexByBase(java.lang.Object index)
           
 void deleteRows(org.hibernate.collection.PersistentCollection collection, java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Delete the persistent state of any elements that were removed from the collection
protected abstract  int doUpdateRows(java.io.Serializable key, org.hibernate.collection.PersistentCollection collection, org.hibernate.engine.SessionImplementor session)
           
 boolean elementExists(java.io.Serializable key, java.lang.Object element, org.hibernate.engine.SessionImplementor session)
           
private  boolean exists(java.io.Serializable key, java.lang.Object indexOrElement, org.hibernate.type.Type indexOrElementType, java.lang.String sql, org.hibernate.engine.SessionImplementor session)
           
protected  java.lang.String filterFragment(java.lang.String alias)
           
 java.lang.String filterFragment(java.lang.String alias, java.util.Map enabledFilters)
          Get the where clause filter, given a query alias and considering enabled session filters
protected abstract  java.lang.String generateDeleteRowString()
           
protected abstract  java.lang.String generateDeleteString()
           
protected  java.lang.String generateDetectRowByElementString()
           
protected  java.lang.String generateDetectRowByIndexString()
           
protected abstract  java.lang.String generateInsertRowString()
           
protected  org.hibernate.sql.SelectFragment generateSelectFragment(java.lang.String alias, java.lang.String columnSuffix)
           
protected  java.lang.String generateSelectRowByIndexString()
           
protected  java.lang.String generateSelectSizeString(boolean isIntegerIndexed)
           
protected abstract  java.lang.String generateUpdateRowString()
           
protected  org.hibernate.loader.collection.CollectionInitializer getAppropriateInitializer(java.io.Serializable key, org.hibernate.engine.SessionImplementor session)
           
 org.hibernate.cache.CacheConcurrencyStrategy getCache()
          Get the cache
 org.hibernate.cache.entry.CacheEntryStructure getCacheEntryStructure()
          Get the cache structure
 org.hibernate.metadata.CollectionMetadata getCollectionMetadata()
           
 java.lang.String[] getCollectionPropertyColumnAliases(java.lang.String propertyName, java.lang.String suffix)
           
 java.io.Serializable[] getCollectionSpaces()
          Get the "space" that holds the persistent state
 org.hibernate.type.CollectionType getCollectionType()
          Get the associated Type
protected  org.hibernate.dialect.Dialect getDialect()
           
 java.lang.Object getElementByIndex(java.io.Serializable key, java.lang.Object index, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
           
 java.lang.Class getElementClass()
          Return the element class of an array, or null otherwise
 java.lang.String[] getElementColumnAliases(java.lang.String suffix)
          Generates the collection's element column aliases, based on the given suffix.
 java.lang.String[] getElementColumnNames()
          Get the names of the collection element columns (or the primary key columns in the case of a one-to-many association)
 java.lang.String[] getElementColumnNames(java.lang.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
 java.lang.String getElementNodeName()
           
 org.hibernate.persister.entity.EntityPersister getElementPersister()
          Get the persister of the element class, if this is a collection of entities (optional operation).
 org.hibernate.type.Type getElementType()
          The collection element type
 org.hibernate.engine.SessionFactoryImplementor getFactory()
           
 org.hibernate.FetchMode getFetchMode()
          Should we load this collection role by outerjoining?
 java.lang.String getIdentifierColumnAlias(java.lang.String suffix)
          Generates the collection's identifier column aliases, based on the given suffix.
 java.lang.String getIdentifierColumnName()
           
 org.hibernate.id.IdentifierGenerator getIdentifierGenerator()
          Get the surrogate key generation strategy (optional operation)
 org.hibernate.type.Type getIdentifierType()
          Get the type of the surrogate key
 java.lang.String[] getIndexColumnAliases(java.lang.String suffix)
          Generates the collection's index column aliases, based on the given suffix.
 java.lang.String[] getIndexColumnNames()
          Get the names of the collection index columns if this is an indexed collection (optional operation)
 java.lang.String[] getIndexColumnNames(java.lang.String alias)
          Get the names of the collection index columns if this is an indexed collection (optional operation), aliased by the given table alias
 java.lang.String[] getIndexFormulas()
          Get the index formulas if this is an indexed collection (optional operation)
 java.lang.String getIndexNodeName()
           
 org.hibernate.type.Type getIndexType()
          The collection index type (or null if the collection has no index)
 java.lang.String[] getKeyColumnAliases(java.lang.String suffix)
          Generates the collection's key column aliases, based on the given suffix.
 java.lang.String[] getKeyColumnNames()
          The columns to join on
 org.hibernate.type.Type getKeyType()
          The collection key type
 java.lang.String getManyToManyFilterFragment(java.lang.String alias, java.util.Map enabledFilters)
           
 java.lang.String getManyToManyOrderByString(java.lang.String alias)
          Get the order-by to be applied at the target table of a many to many
 java.lang.String getName()
          An identifying name; a class name or collection role name.
 java.lang.String getNodeName()
           
 java.lang.String getOwnerEntityName()
           
 org.hibernate.persister.entity.EntityPersister getOwnerEntityPersister()
          Get the persister of the entity that "owns" this collection
 java.lang.String getRole()
          The name of this collection role
 int getSize(java.io.Serializable key, org.hibernate.engine.SessionImplementor session)
           
protected  java.lang.String getSQLDeleteRowString()
           
protected  java.lang.String getSQLDeleteString()
           
protected  org.hibernate.exception.SQLExceptionConverter getSQLExceptionConverter()
           
protected  java.lang.String getSQLInsertRowString()
           
 java.lang.String getSQLOrderByString(java.lang.String alias)
          Get the order by SQL
protected  java.lang.String getSQLUpdateRowString()
           
protected  java.lang.String getSQLWhereString(java.lang.String alias)
           
private  org.hibernate.loader.collection.CollectionInitializer getSubselectInitializer(java.io.Serializable key, org.hibernate.engine.SessionImplementor session)
           
 java.lang.String getTableName()
          The table to join to.
 org.hibernate.type.Type getType()
          Get the type of the thing containing the properties
 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  java.lang.Object incrementIndexByBase(java.lang.Object index)
           
 boolean indexExists(java.io.Serializable key, java.lang.Object index, org.hibernate.engine.SessionImplementor session)
           
 void initCollectionPropertyMap()
           
private  void initCollectionPropertyMap(java.lang.String aliasName, org.hibernate.type.Type type, java.lang.String[] columnAliases, java.lang.String[] columnNames)
           
 void initialize(java.io.Serializable key, org.hibernate.engine.SessionImplementor session)
          Initialize the given collection with the given key
 void insertRows(org.hibernate.collection.PersistentCollection collection, java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Insert the persistent state of any new collection elements
 boolean isAffectedByEnabledFilters(org.hibernate.engine.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()
           
 java.lang.String oneToManyFilterFragment(java.lang.String alias)
           
 void postInstantiate()
           
private static java.lang.String[] qualify(java.lang.String alias, java.lang.String[] columnNames, java.lang.String[] formulaTemplates)
           
 java.lang.Object readElement(java.sql.ResultSet rs, java.lang.Object owner, java.lang.String[] aliases, org.hibernate.engine.SessionImplementor session)
          Read the element from a row of the JDBC ResultSet
 java.lang.Object readIdentifier(java.sql.ResultSet rs, java.lang.String alias, org.hibernate.engine.SessionImplementor session)
          Read the identifier from a row of the JDBC ResultSet
 java.lang.Object readIndex(java.sql.ResultSet rs, java.lang.String[] aliases, org.hibernate.engine.SessionImplementor session)
          Read the index from a row of the JDBC ResultSet
 java.lang.Object readKey(java.sql.ResultSet rs, java.lang.String[] aliases, org.hibernate.engine.SessionImplementor session)
          Read the key from a row of the JDBC ResultSet
 void recreate(org.hibernate.collection.PersistentCollection collection, java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          (Re)create the collection's persistent state
 void remove(java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Completely remove the persistent state of the collection
 java.lang.String selectFragment(java.lang.String alias, java.lang.String columnSuffix)
          Generate a list of collection index, key and element columns
 java.lang.String[] toColumns(java.lang.String propertyName)
          Given a property path, return the corresponding column name(s).
 java.lang.String[] toColumns(java.lang.String alias, java.lang.String propertyName)
          Given a query alias and a property path, return the qualified column name
 java.lang.String toString()
          Convert this Object to a human-readable String.
 org.hibernate.type.Type toType(java.lang.String propertyName)
          Given a component path expression, get the type of the property
 void updateRows(org.hibernate.collection.PersistentCollection collection, java.io.Serializable id, org.hibernate.engine.SessionImplementor session)
          Update the persistent state of any elements that were modified
protected  int writeElement(java.sql.PreparedStatement st, java.lang.Object elt, int i, org.hibernate.engine.SessionImplementor session)
          Write the element to a JDBC PreparedStatement
protected  int writeElementToWhere(java.sql.PreparedStatement st, java.lang.Object elt, int i, org.hibernate.engine.SessionImplementor session)
          Write the element to a JDBC PreparedStatement
 int writeIdentifier(java.sql.PreparedStatement st, java.lang.Object id, int i, org.hibernate.engine.SessionImplementor session)
          Write the identifier to a JDBC PreparedStatement
protected  int writeIndex(java.sql.PreparedStatement st, java.lang.Object index, int i, org.hibernate.engine.SessionImplementor session)
          Write the index to a JDBC PreparedStatement
protected  int writeIndexToWhere(java.sql.PreparedStatement st, java.lang.Object index, int i, org.hibernate.engine.SessionImplementor session)
          Write the index to a JDBC PreparedStatement
protected  int writeKey(java.sql.PreparedStatement st, java.io.Serializable key, int i, org.hibernate.engine.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

role

private final java.lang.String role

sqlDeleteString

private final java.lang.String sqlDeleteString

sqlInsertRowString

private final java.lang.String sqlInsertRowString

sqlUpdateRowString

private final java.lang.String sqlUpdateRowString

sqlDeleteRowString

private final java.lang.String sqlDeleteRowString

sqlSelectSizeString

private final java.lang.String sqlSelectSizeString

sqlSelectRowByIndexString

private final java.lang.String sqlSelectRowByIndexString

sqlDetectRowByIndexString

private final java.lang.String sqlDetectRowByIndexString

sqlDetectRowByElementString

private final java.lang.String sqlDetectRowByElementString

sqlOrderByString

private final java.lang.String sqlOrderByString

sqlWhereString

protected final java.lang.String sqlWhereString

sqlOrderByStringTemplate

private final java.lang.String sqlOrderByStringTemplate

sqlWhereStringTemplate

private final java.lang.String sqlWhereStringTemplate

hasOrder

private final boolean hasOrder

hasWhere

protected final boolean hasWhere

baseIndex

private final int baseIndex

nodeName

private final java.lang.String nodeName

elementNodeName

private final java.lang.String elementNodeName

indexNodeName

private final java.lang.String indexNodeName

indexContainsFormula

protected final boolean indexContainsFormula

elementIsPureFormula

protected final boolean elementIsPureFormula

keyType

private final org.hibernate.type.Type keyType

indexType

private final org.hibernate.type.Type indexType

elementType

protected final org.hibernate.type.Type elementType

identifierType

private final org.hibernate.type.Type identifierType

keyColumnNames

protected final java.lang.String[] keyColumnNames

indexColumnNames

protected final java.lang.String[] indexColumnNames

indexFormulaTemplates

protected final java.lang.String[] indexFormulaTemplates

indexFormulas

protected final java.lang.String[] indexFormulas

indexColumnIsSettable

protected final boolean[] indexColumnIsSettable

elementColumnNames

protected final java.lang.String[] elementColumnNames

elementFormulaTemplates

protected final java.lang.String[] elementFormulaTemplates

elementFormulas

protected final java.lang.String[] elementFormulas

elementColumnIsSettable

protected final boolean[] elementColumnIsSettable

elementColumnIsInPrimaryKey

protected final boolean[] elementColumnIsInPrimaryKey

indexColumnAliases

protected final java.lang.String[] indexColumnAliases

elementColumnAliases

protected final java.lang.String[] elementColumnAliases

keyColumnAliases

protected final java.lang.String[] keyColumnAliases

identifierColumnName

protected final java.lang.String identifierColumnName

identifierColumnAlias

private final java.lang.String identifierColumnAlias

qualifiedTableName

protected final java.lang.String qualifiedTableName

queryLoaderName

private final java.lang.String queryLoaderName

isPrimitiveArray

private final boolean isPrimitiveArray

isArray

private final boolean isArray

hasIndex

protected final boolean hasIndex

hasIdentifier

protected final boolean hasIdentifier

isLazy

private final boolean isLazy

isExtraLazy

private final boolean isExtraLazy

isInverse

private final boolean isInverse

isMutable

private final boolean isMutable

isVersioned

private final boolean isVersioned

batchSize

protected final int batchSize

fetchMode

private final org.hibernate.FetchMode fetchMode

hasOrphanDelete

private final boolean hasOrphanDelete

subselectLoadable

private final boolean subselectLoadable

elementClass

private final java.lang.Class elementClass

entityName

private final java.lang.String entityName

dialect

private final org.hibernate.dialect.Dialect dialect

sqlExceptionConverter

private final org.hibernate.exception.SQLExceptionConverter sqlExceptionConverter

factory

private final org.hibernate.engine.SessionFactoryImplementor factory

ownerPersister

private final org.hibernate.persister.entity.EntityPersister ownerPersister

identifierGenerator

private final org.hibernate.id.IdentifierGenerator identifierGenerator

elementPropertyMapping

private final org.hibernate.persister.entity.PropertyMapping elementPropertyMapping

elementPersister

private final org.hibernate.persister.entity.EntityPersister elementPersister

cache

private final org.hibernate.cache.CacheConcurrencyStrategy cache

collectionType

private final org.hibernate.type.CollectionType collectionType

initializer

private org.hibernate.loader.collection.CollectionInitializer initializer

cacheEntryStructure

private final org.hibernate.cache.entry.CacheEntryStructure cacheEntryStructure

filterHelper

private final org.hibernate.util.FilterHelper filterHelper

manyToManyFilterHelper

private final org.hibernate.util.FilterHelper manyToManyFilterHelper

manyToManyWhereString

private final java.lang.String manyToManyWhereString

manyToManyWhereTemplate

private final java.lang.String manyToManyWhereTemplate

manyToManyOrderByString

private final java.lang.String manyToManyOrderByString