Class AbstractCollectionPersister
- java.lang.Object
-
- org.hibernate.persister.collection.AbstractCollectionPersister
-
- All Implemented Interfaces:
CollectionMetadata,CollectionPersister,QueryableCollection,SQLLoadableCollection,Joinable,PropertyMapping,CollectionDefinition
- Direct Known Subclasses:
BasicCollectionPersister,OneToManyPersister
public abstract class AbstractCollectionPersister extends java.lang.Object implements CollectionMetadata, SQLLoadableCollection
Base implementation of the QueryableCollection interface.- See Also:
BasicCollectionPersister,OneToManyPersister
-
-
Field Summary
Fields Modifier and Type Field Description protected intbatchSizeprotected java.lang.String[]elementColumnAliasesprotected boolean[]elementColumnIsGettableprotected boolean[]elementColumnIsInPrimaryKeyprotected boolean[]elementColumnIsSettableprotected java.lang.String[]elementColumnNamesprotected java.lang.String[]elementColumnReadersprotected java.lang.String[]elementColumnReaderTemplatesprotected java.lang.String[]elementColumnWritersprotected java.lang.String[]elementFormulasprotected java.lang.String[]elementFormulaTemplatesprotected booleanelementIsPureFormulaprotected TypeelementTypeprotected booleanhasIdentifierprotected booleanhasIndexprotected booleanhasWhereprotected java.lang.StringidentifierColumnNameprotected java.lang.String[]indexColumnAliasesprotected boolean[]indexColumnIsGettableprotected boolean[]indexColumnIsSettableprotected java.lang.String[]indexColumnNamesprotected booleanindexContainsFormulaprotected java.lang.String[]indexFormulasprotected java.lang.String[]indexFormulaTemplatesprotected booleanisInverseprotected java.lang.String[]keyColumnAliasesprotected java.lang.String[]keyColumnNamesprotected java.lang.StringqualifiedTableNameprotected org.hibernate.engine.jdbc.batch.internal.BasicBatchKeyrecreateBatchKeyprotected SqlExceptionHelpersqlExceptionHelperprotected java.lang.StringsqlWhereString
-
Constructor Summary
Constructors Constructor Description AbstractCollectionPersister(Collection collectionBinding, CollectionDataAccess cacheAccessStrategy, PersisterCreationContext creationContext)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidappendElementColumns(SelectFragment frag, java.lang.String elemAlias)protected voidappendIdentifierColumns(SelectFragment frag, java.lang.String alias)protected voidappendIndexColumns(SelectFragment frag, java.lang.String alias)protected abstract CollectionInitializercreateCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)protected DeletecreateDelete()protected InsertcreateInsert()protected abstract CollectionInitializercreateSubselectInitializer(SubselectFetch subselect, SharedSessionContractImplementor session)protected UpdatecreateUpdate()protected java.lang.ObjectdecrementIndexByBase(java.lang.Object index)voiddeleteRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)Delete the persistent state of any elements that were removed from the collectionprotected java.lang.StringdetermineTableName(Table table)protected voiddoProcessQueuedOps(PersistentCollection collection, java.io.Serializable key, int nextIndex, SharedSessionContractImplementor session)protected abstract voiddoProcessQueuedOps(PersistentCollection collection, java.io.Serializable key, SharedSessionContractImplementor session)protected abstract intdoUpdateRows(java.io.Serializable key, PersistentCollection collection, SharedSessionContractImplementor session)booleanelementExists(java.io.Serializable key, java.lang.Object element, SharedSessionContractImplementor session)protected java.lang.StringfilterFragment(java.lang.String alias)java.lang.StringfilterFragment(java.lang.String alias, java.util.Map enabledFilters)Get the where clause filter, given a query alias and considering enabled session filtersjava.lang.StringfilterFragment(java.lang.String alias, java.util.Map enabledFilters, java.util.Set<java.lang.String> treatAsDeclarations)Get the where clause filter, given a query alias and considering enabled session filtersprotected java.lang.StringfilterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)protected abstract java.lang.StringgenerateDeleteRowString()protected abstract java.lang.StringgenerateDeleteString()protected java.lang.StringgenerateDetectRowByElementString()protected java.lang.StringgenerateDetectRowByIndexString()protected abstract java.lang.StringgenerateInsertRowString()protected SelectFragmentgenerateSelectFragment(java.lang.String alias, java.lang.String columnSuffix)protected java.lang.StringgenerateSelectRowByIndexString()protected java.lang.StringgenerateSelectSizeString(boolean isIntegerIndexed)protected abstract java.lang.StringgenerateUpdateRowString()protected CollectionInitializergetAppropriateInitializer(java.io.Serializable key, SharedSessionContractImplementor session)intgetBatchSize()CollectionDataAccessgetCacheAccessStrategy()Get the cacheCacheEntryStructuregetCacheEntryStructure()Get the cache structureCollectionMetadatagetCollectionMetadata()CollectionPersistergetCollectionPersister()java.lang.String[]getCollectionPropertyColumnAliases(java.lang.String propertyName, java.lang.String suffix)java.io.Serializable[]getCollectionSpaces()Get the "space" that holds the persistent stateCollectionTypegetCollectionType()Get the associated Typeprotected ExecuteUpdateResultCheckStylegetDeleteAllCheckStyle()protected ExecuteUpdateResultCheckStylegetDeleteCheckStyle()protected DialectgetDialect()java.lang.ObjectgetElementByIndex(java.io.Serializable key, java.lang.Object index, SharedSessionContractImplementor session, java.lang.Object owner)java.lang.ClassgetElementClass()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 aliasCollectionElementDefinitiongetElementDefinition()EntityPersistergetElementPersister()Get the persister of the element class, if this is a collection of entities (optional operation).TypegetElementType()The collection element typeSessionFactoryImplementorgetFactory()FetchModegetFetchMode()Should we load this collection role by outerjoining?abstract org.hibernate.internal.FilterAliasGeneratorgetFilterAliasGenerator(java.lang.String rootAlias)java.lang.StringgetIdentifierColumnAlias(java.lang.String suffix)Generates the collection's identifier column aliases, based on the given suffix.java.lang.StringgetIdentifierColumnName()IdentifierGeneratorgetIdentifierGenerator()Get the surrogate key generation strategy (optional operation)TypegetIdentifierType()Get the type of the surrogate keyjava.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 aliasCollectionIndexDefinitiongetIndexDefinition()java.lang.String[]getIndexFormulas()Get the index formulas if this is an indexed collection (optional operation)TypegetIndexType()The collection index type (or null if the collection has no index)CollectionInitializergetInitializer()Intended for internal use only.protected ExecuteUpdateResultCheckStylegetInsertCheckStyle()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 onTypegetKeyType()The collection key typejava.lang.StringgetManyToManyFilterFragment(java.lang.String alias, java.util.Map enabledFilters)java.lang.StringgetManyToManyOrderByString(java.lang.String alias)Get the order-by to be applied at the target table of a many to manyjava.lang.StringgetMappedByProperty()java.lang.StringgetName()An identifying name; a class name or collection role name.NavigableRolegetNavigableRole()java.lang.StringgetOwnerEntityName()EntityPersistergetOwnerEntityPersister()Get the persister of the entity that "owns" this collectionjava.lang.StringgetRole()The name of this collection roleintgetSize(java.io.Serializable key, SharedSessionContractImplementor session)protected java.lang.StringgetSQLDeleteRowString()protected java.lang.StringgetSQLDeleteString()protected SQLExceptionConvertergetSQLExceptionConverter()protected SqlExceptionHelpergetSQLExceptionHelper()protected java.lang.StringgetSQLInsertRowString()java.lang.StringgetSQLOrderByString(java.lang.String alias)Get the order by SQLprotected java.lang.StringgetSQLUpdateRowString()protected java.lang.StringgetSQLWhereString(java.lang.String alias)java.lang.StringgetTableName()The table to join to.TypegetType()Get the type of the thing containing the propertiesprotected ExecuteUpdateResultCheckStylegetUpdateCheckStyle()booleanhasCache()Is this collection role cacheablebooleanhasIndex()Is this collection indexed?booleanhasManyToManyOrdering()booleanhasOrdering()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.)booleanhasOrphanDelete()Does this collection implement "orphan delete"?booleanhasWhere()Does this collection role have a where clause filter?protected java.lang.ObjectincrementIndexByBase(java.lang.Object index)booleanindexExists(java.io.Serializable key, java.lang.Object index, SharedSessionContractImplementor session)voidinitCollectionPropertyMap()voidinitialize(java.io.Serializable key, SharedSessionContractImplementor session)Initialize the given collection with the given key TODO: add owner argument!!voidinsertRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)Insert the persistent state of any new collection elementsbooleanisAffectedByEnabledFilters(SharedSessionContractImplementor session)booleanisArray()Is the collection an array?booleanisCollection()Is this instance actually a CollectionPersister?protected booleanisDeleteAllCallable()protected booleanisDeleteCallable()booleanisExtraLazy()protected booleanisInsertCallable()booleanisInverse()Is this collection "inverse", so state changes are not propagated to the database.booleanisLazy()Is the collection lazily initialized?abstract booleanisManyToMany()Is this a many-to-many association? Note that this is mainly a convenience feature as the single persister does not contain all the information needed to handle a many-to-many itself, as internally it is looked at as two many-to-ones.booleanisMutable()Can the elements of this collection change?booleanisPrimitiveArray()Is the collection a primitive array?protected booleanisRowDeleteEnabled()protected booleanisRowInsertEnabled()booleanisSubselectLoadable()protected booleanisUpdateCallable()booleanisVersioned()Does this collection cause version increment of the owning entity?protected voidlogStaticSQL()java.lang.StringoneToManyFilterFragment(java.lang.String alias)java.lang.StringoneToManyFilterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)voidpostInstantiate()voidprocessQueuedOps(PersistentCollection collection, java.io.Serializable key, SharedSessionContractImplementor session)Process queued operations within the PersistentCollection.java.lang.ObjectreadElement(java.sql.ResultSet rs, java.lang.Object owner, java.lang.String[] aliases, SharedSessionContractImplementor session)Read the element from a row of the JDBC ResultSetjava.lang.ObjectreadIdentifier(java.sql.ResultSet rs, java.lang.String alias, SharedSessionContractImplementor session)Read the identifier from a row of the JDBC ResultSetjava.lang.ObjectreadIndex(java.sql.ResultSet rs, java.lang.String[] aliases, SharedSessionContractImplementor session)Read the index from a row of the JDBC ResultSetjava.lang.ObjectreadKey(java.sql.ResultSet rs, java.lang.String[] aliases, SharedSessionContractImplementor session)Read the key from a row of the JDBC ResultSetvoidrecreate(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)(Re)create the collection's persistent statevoidremove(java.io.Serializable id, SharedSessionContractImplementor session)Completely remove the persistent state of the collectionjava.lang.StringselectFragment(java.lang.String alias, java.lang.String columnSuffix)Generate a list of collection index, key and element columnsjava.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)Obtain aliased column/formula fragments for the specified property path.java.lang.StringtoString()TypetoType(java.lang.String propertyName)Given a component path expression, get the type of the propertyvoidupdateRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)Update the persistent state of any elements that were modifiedprotected intwriteElement(java.sql.PreparedStatement st, java.lang.Object elt, int i, SharedSessionContractImplementor session)Write the element to a JDBC PreparedStatementprotected intwriteElementToWhere(java.sql.PreparedStatement st, java.lang.Object elt, int i, SharedSessionContractImplementor session)Write the element to a JDBC PreparedStatementintwriteIdentifier(java.sql.PreparedStatement st, java.lang.Object id, int i, SharedSessionContractImplementor session)Write the identifier to a JDBC PreparedStatementprotected intwriteIndex(java.sql.PreparedStatement st, java.lang.Object index, int i, SharedSessionContractImplementor session)Write the index to a JDBC PreparedStatementprotected intwriteIndexToWhere(java.sql.PreparedStatement st, java.lang.Object index, int i, SharedSessionContractImplementor session)Write the index to a JDBC PreparedStatementprotected intwriteKey(java.sql.PreparedStatement st, java.io.Serializable key, int i, SharedSessionContractImplementor 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.collection.CollectionPersister
isCascadeDeleteEnabled, isOneToMany
-
Methods inherited from interface org.hibernate.persister.entity.Joinable
consumesCollectionAlias, consumesEntityAlias, fromJoinFragment, fromJoinFragment, fromJoinFragment, selectFragment, whereJoinFragment, whereJoinFragment
-
-
-
-
Field Detail
-
hasWhere
protected final boolean hasWhere
-
sqlWhereString
protected final java.lang.String sqlWhereString
-
indexContainsFormula
protected final boolean indexContainsFormula
-
elementIsPureFormula
protected final boolean elementIsPureFormula
-
elementType
protected final Type elementType
-
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
-
indexColumnIsGettable
protected final boolean[] indexColumnIsGettable
-
indexColumnIsSettable
protected final boolean[] indexColumnIsSettable
-
elementColumnNames
protected final java.lang.String[] elementColumnNames
-
elementColumnWriters
protected final java.lang.String[] elementColumnWriters
-
elementColumnReaders
protected final java.lang.String[] elementColumnReaders
-
elementColumnReaderTemplates
protected final java.lang.String[] elementColumnReaderTemplates
-
elementFormulaTemplates
protected final java.lang.String[] elementFormulaTemplates
-
elementFormulas
protected final java.lang.String[] elementFormulas
-
elementColumnIsGettable
protected final boolean[] elementColumnIsGettable
-
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
-
qualifiedTableName
protected final java.lang.String qualifiedTableName
-
hasIndex
protected final boolean hasIndex
-
hasIdentifier
protected final boolean hasIdentifier
-
isInverse
protected final boolean isInverse
-
batchSize
protected final int batchSize
-
sqlExceptionHelper
protected final SqlExceptionHelper sqlExceptionHelper
-
recreateBatchKey
protected org.hibernate.engine.jdbc.batch.internal.BasicBatchKey recreateBatchKey
-
-
Constructor Detail
-
AbstractCollectionPersister
public AbstractCollectionPersister(Collection collectionBinding, CollectionDataAccess cacheAccessStrategy, PersisterCreationContext creationContext) throws MappingException, CacheException
- Throws:
MappingExceptionCacheException
-
-
Method Detail
-
determineTableName
protected java.lang.String determineTableName(Table table)
-
postInstantiate
public void postInstantiate() throws MappingException- Specified by:
postInstantiatein interfaceCollectionPersister- Throws:
MappingException
-
logStaticSQL
protected void logStaticSQL()
-
initialize
public void initialize(java.io.Serializable key, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:CollectionPersisterInitialize the given collection with the given key TODO: add owner argument!!- Specified by:
initializein interfaceCollectionPersister- Throws:
HibernateException
-
getAppropriateInitializer
protected CollectionInitializer getAppropriateInitializer(java.io.Serializable key, SharedSessionContractImplementor session)
-
createSubselectInitializer
protected abstract CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SharedSessionContractImplementor session)
-
createCollectionInitializer
protected abstract CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers) throws MappingException
- Throws:
MappingException
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRolein interfaceCollectionPersister
-
getCacheAccessStrategy
public CollectionDataAccess getCacheAccessStrategy()
Description copied from interface:CollectionPersisterGet the cache- Specified by:
getCacheAccessStrategyin interfaceCollectionPersister
-
hasCache
public boolean hasCache()
Description copied from interface:CollectionPersisterIs this collection role cacheable- Specified by:
hasCachein interfaceCollectionPersister
-
getCollectionType
public CollectionType getCollectionType()
Description copied from interface:CollectionPersisterGet the associated Type- Specified by:
getCollectionTypein interfaceCollectionDefinition- Specified by:
getCollectionTypein interfaceCollectionPersister
-
getSQLWhereString
protected java.lang.String getSQLWhereString(java.lang.String alias)
-
getSQLOrderByString
public java.lang.String getSQLOrderByString(java.lang.String alias)
Description copied from interface:QueryableCollectionGet the order by SQL- Specified by:
getSQLOrderByStringin interfaceQueryableCollection
-
getManyToManyOrderByString
public java.lang.String getManyToManyOrderByString(java.lang.String alias)
Description copied from interface:QueryableCollectionGet the order-by to be applied at the target table of a many to many- Specified by:
getManyToManyOrderByStringin interfaceQueryableCollection- 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:QueryableCollectionShould we load this collection role by outerjoining?- Specified by:
getFetchModein interfaceQueryableCollection
-
hasOrdering
public boolean hasOrdering()
Description copied from interface:CollectionPersisterIs 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:
hasOrderingin interfaceCollectionPersister
-
hasManyToManyOrdering
public boolean hasManyToManyOrdering()
- Specified by:
hasManyToManyOrderingin interfaceCollectionPersister
-
hasWhere
public boolean hasWhere()
Description copied from interface:QueryableCollectionDoes this collection role have a where clause filter?- Specified by:
hasWherein interfaceQueryableCollection
-
getSQLDeleteString
protected java.lang.String getSQLDeleteString()
-
getSQLInsertRowString
protected java.lang.String getSQLInsertRowString()
-
getSQLUpdateRowString
protected java.lang.String getSQLUpdateRowString()
-
getSQLDeleteRowString
protected java.lang.String getSQLDeleteRowString()
-
getKeyType
public Type getKeyType()
Description copied from interface:CollectionMetadataThe collection key type- Specified by:
getKeyTypein interfaceCollectionMetadata- Specified by:
getKeyTypein interfaceCollectionPersister
-
getIndexType
public Type getIndexType()
Description copied from interface:CollectionMetadataThe collection index type (or null if the collection has no index)- Specified by:
getIndexTypein interfaceCollectionMetadata- Specified by:
getIndexTypein interfaceCollectionPersister
-
getElementType
public Type getElementType()
Description copied from interface:CollectionMetadataThe collection element type- Specified by:
getElementTypein interfaceCollectionMetadata- Specified by:
getElementTypein interfaceCollectionPersister
-
getElementClass
public java.lang.Class getElementClass()
Return the element class of an array, or null otherwise. needed by arrays- Specified by:
getElementClassin interfaceCollectionPersister
-
readElement
public java.lang.Object readElement(java.sql.ResultSet rs, java.lang.Object owner, java.lang.String[] aliases, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionDescription copied from interface:CollectionPersisterRead the element from a row of the JDBC ResultSet- Specified by:
readElementin interfaceCollectionPersister- Throws:
HibernateExceptionjava.sql.SQLException
-
readIndex
public java.lang.Object readIndex(java.sql.ResultSet rs, java.lang.String[] aliases, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionDescription copied from interface:CollectionPersisterRead the index from a row of the JDBC ResultSet- Specified by:
readIndexin interfaceCollectionPersister- Throws:
HibernateExceptionjava.sql.SQLException
-
decrementIndexByBase
protected java.lang.Object decrementIndexByBase(java.lang.Object index)
-
readIdentifier
public java.lang.Object readIdentifier(java.sql.ResultSet rs, java.lang.String alias, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionDescription copied from interface:CollectionPersisterRead the identifier from a row of the JDBC ResultSet- Specified by:
readIdentifierin interfaceCollectionPersister- Throws:
HibernateExceptionjava.sql.SQLException
-
readKey
public java.lang.Object readKey(java.sql.ResultSet rs, java.lang.String[] aliases, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionDescription copied from interface:CollectionPersisterRead the key from a row of the JDBC ResultSet- Specified by:
readKeyin interfaceCollectionPersister- Throws:
HibernateExceptionjava.sql.SQLException
-
writeKey
protected int writeKey(java.sql.PreparedStatement st, java.io.Serializable key, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionWrite the key to a JDBC PreparedStatement- Throws:
HibernateExceptionjava.sql.SQLException
-
writeElement
protected int writeElement(java.sql.PreparedStatement st, java.lang.Object elt, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionWrite the element to a JDBC PreparedStatement- Throws:
HibernateExceptionjava.sql.SQLException
-
writeIndex
protected int writeIndex(java.sql.PreparedStatement st, java.lang.Object index, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionWrite the index to a JDBC PreparedStatement- Throws:
HibernateExceptionjava.sql.SQLException
-
incrementIndexByBase
protected java.lang.Object incrementIndexByBase(java.lang.Object index)
-
writeElementToWhere
protected int writeElementToWhere(java.sql.PreparedStatement st, java.lang.Object elt, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionWrite the element to a JDBC PreparedStatement- Throws:
HibernateExceptionjava.sql.SQLException
-
writeIndexToWhere
protected int writeIndexToWhere(java.sql.PreparedStatement st, java.lang.Object index, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionWrite the index to a JDBC PreparedStatement- Throws:
HibernateExceptionjava.sql.SQLException
-
writeIdentifier
public int writeIdentifier(java.sql.PreparedStatement st, java.lang.Object id, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLExceptionWrite the identifier to a JDBC PreparedStatement- Throws:
HibernateExceptionjava.sql.SQLException
-
isPrimitiveArray
public boolean isPrimitiveArray()
Description copied from interface:CollectionMetadataIs the collection a primitive array?- Specified by:
isPrimitiveArrayin interfaceCollectionMetadata- Specified by:
isPrimitiveArrayin interfaceCollectionPersister
-
isArray
public boolean isArray()
Description copied from interface:CollectionMetadataIs the collection an array?- Specified by:
isArrayin interfaceCollectionMetadata- Specified by:
isArrayin interfaceCollectionPersister
-
getKeyColumnAliases
public java.lang.String[] getKeyColumnAliases(java.lang.String suffix)
Description copied from interface:CollectionPersisterGenerates the collection's key column aliases, based on the given suffix.- Specified by:
getKeyColumnAliasesin interfaceCollectionPersister- Parameters:
suffix- The suffix to use in the key column alias generation.- Returns:
- The key column aliases.
-
getElementColumnAliases
public java.lang.String[] getElementColumnAliases(java.lang.String suffix)
Description copied from interface:CollectionPersisterGenerates the collection's element column aliases, based on the given suffix.- Specified by:
getElementColumnAliasesin interfaceCollectionPersister- Parameters:
suffix- The suffix to use in the element column alias generation.- Returns:
- The key column aliases.
-
getIndexColumnAliases
public java.lang.String[] getIndexColumnAliases(java.lang.String suffix)
Description copied from interface:CollectionPersisterGenerates the collection's index column aliases, based on the given suffix.- Specified by:
getIndexColumnAliasesin interfaceCollectionPersister- Parameters:
suffix- The suffix to use in the index column alias generation.- Returns:
- The key column aliases, or null if not indexed.
-
getIdentifierColumnAlias
public java.lang.String getIdentifierColumnAlias(java.lang.String suffix)
Description copied from interface:CollectionPersisterGenerates the collection's identifier column aliases, based on the given suffix.- Specified by:
getIdentifierColumnAliasin interfaceCollectionPersister- Parameters:
suffix- The suffix to use in the key column alias generation.- Returns:
- The key column aliases.
-
getIdentifierColumnName
public java.lang.String getIdentifierColumnName()
- Specified by:
getIdentifierColumnNamein interfaceSQLLoadableCollection
-
selectFragment
public java.lang.String selectFragment(java.lang.String alias, java.lang.String columnSuffix)Generate a list of collection index, key and element columns- Specified by:
selectFragmentin interfaceQueryableCollection
-
generateSelectSizeString
protected java.lang.String generateSelectSizeString(boolean isIntegerIndexed)
-
generateDetectRowByIndexString
protected java.lang.String generateDetectRowByIndexString()
-
generateSelectRowByIndexString
protected java.lang.String generateSelectRowByIndexString()
-
generateDetectRowByElementString
protected java.lang.String generateDetectRowByElementString()
-
generateSelectFragment
protected SelectFragment generateSelectFragment(java.lang.String alias, java.lang.String columnSuffix)
-
appendElementColumns
protected void appendElementColumns(SelectFragment frag, java.lang.String elemAlias)
-
appendIndexColumns
protected void appendIndexColumns(SelectFragment frag, java.lang.String alias)
-
appendIdentifierColumns
protected void appendIdentifierColumns(SelectFragment frag, java.lang.String alias)
-
getIndexColumnNames
public java.lang.String[] getIndexColumnNames()
Description copied from interface:QueryableCollectionGet the names of the collection index columns if this is an indexed collection (optional operation)- Specified by:
getIndexColumnNamesin interfaceQueryableCollection
-
getIndexFormulas
public java.lang.String[] getIndexFormulas()
Description copied from interface:QueryableCollectionGet the index formulas if this is an indexed collection (optional operation)- Specified by:
getIndexFormulasin interfaceQueryableCollection
-
getIndexColumnNames
public java.lang.String[] getIndexColumnNames(java.lang.String alias)
Description copied from interface:QueryableCollectionGet the names of the collection index columns if this is an indexed collection (optional operation), aliased by the given table alias- Specified by:
getIndexColumnNamesin interfaceQueryableCollection
-
getElementColumnNames
public java.lang.String[] getElementColumnNames(java.lang.String alias)
Description copied from interface:QueryableCollectionGet 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:
getElementColumnNamesin interfaceQueryableCollection
-
getElementColumnNames
public java.lang.String[] getElementColumnNames()
Description copied from interface:QueryableCollectionGet the names of the collection element columns (or the primary key columns in the case of a one-to-many association)- Specified by:
getElementColumnNamesin interfaceQueryableCollection
-
getKeyColumnNames
public java.lang.String[] getKeyColumnNames()
Description copied from interface:JoinableThe columns to join on- Specified by:
getKeyColumnNamesin interfaceJoinable
-
hasIndex
public boolean hasIndex()
Description copied from interface:CollectionMetadataIs this collection indexed?- Specified by:
hasIndexin interfaceCollectionMetadata- Specified by:
hasIndexin interfaceCollectionPersister
-
isLazy
public boolean isLazy()
Description copied from interface:CollectionMetadataIs the collection lazily initialized?- Specified by:
isLazyin interfaceCollectionMetadata- Specified by:
isLazyin interfaceCollectionPersister
-
isInverse
public boolean isInverse()
Description copied from interface:CollectionPersisterIs this collection "inverse", so state changes are not propagated to the database.- Specified by:
isInversein interfaceCollectionPersister
-
getTableName
public java.lang.String getTableName()
Description copied from interface:JoinableThe table to join to.- Specified by:
getTableNamein interfaceJoinable
-
remove
public void remove(java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:CollectionPersisterCompletely remove the persistent state of the collection- Specified by:
removein interfaceCollectionPersister- Throws:
HibernateException
-
recreate
public void recreate(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:CollectionPersister(Re)create the collection's persistent state- Specified by:
recreatein interfaceCollectionPersister- Throws:
HibernateException
-
isRowDeleteEnabled
protected boolean isRowDeleteEnabled()
-
deleteRows
public void deleteRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:CollectionPersisterDelete the persistent state of any elements that were removed from the collection- Specified by:
deleteRowsin interfaceCollectionPersister- Throws:
HibernateException
-
isRowInsertEnabled
protected boolean isRowInsertEnabled()
-
insertRows
public void insertRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:CollectionPersisterInsert the persistent state of any new collection elements- Specified by:
insertRowsin interfaceCollectionPersister- Throws:
HibernateException
-
getRole
public java.lang.String getRole()
Description copied from interface:CollectionMetadataThe name of this collection role- Specified by:
getRolein interfaceCollectionMetadata- Specified by:
getRolein interfaceCollectionPersister
-
getOwnerEntityName
public java.lang.String getOwnerEntityName()
-
getOwnerEntityPersister
public EntityPersister getOwnerEntityPersister()
Description copied from interface:CollectionPersisterGet the persister of the entity that "owns" this collection- Specified by:
getOwnerEntityPersisterin interfaceCollectionPersister
-
getIdentifierGenerator
public IdentifierGenerator getIdentifierGenerator()
Description copied from interface:CollectionPersisterGet the surrogate key generation strategy (optional operation)- Specified by:
getIdentifierGeneratorin interfaceCollectionPersister
-
getIdentifierType
public Type getIdentifierType()
Description copied from interface:CollectionPersisterGet the type of the surrogate key- Specified by:
getIdentifierTypein interfaceCollectionPersister
-
hasOrphanDelete
public boolean hasOrphanDelete()
Description copied from interface:CollectionPersisterDoes this collection implement "orphan delete"?- Specified by:
hasOrphanDeletein interfaceCollectionPersister
-
toType
public Type toType(java.lang.String propertyName) throws QueryException
Description copied from interface:PropertyMappingGiven a component path expression, get the type of the property- Specified by:
toTypein interfacePropertyMapping- Throws:
QueryException
-
isManyToMany
public abstract boolean isManyToMany()
Description copied from interface:CollectionPersisterIs this a many-to-many association? Note that this is mainly a convenience feature as the single persister does not contain all the information needed to handle a many-to-many itself, as internally it is looked at as two many-to-ones.- Specified by:
isManyToManyin interfaceCollectionPersister
-
getManyToManyFilterFragment
public java.lang.String getManyToManyFilterFragment(java.lang.String alias, java.util.Map enabledFilters)- Specified by:
getManyToManyFilterFragmentin interfaceCollectionPersister
-
toColumns
public java.lang.String[] toColumns(java.lang.String alias, java.lang.String propertyName) throws QueryExceptionDescription copied from interface:PropertyMappingObtain aliased column/formula fragments for the specified property path.- Specified by:
toColumnsin interfacePropertyMapping- Throws:
QueryException
-
toColumns
public java.lang.String[] toColumns(java.lang.String propertyName) throws QueryExceptionDescription copied from interface:PropertyMappingGiven a property path, return the corresponding column name(s).- Specified by:
toColumnsin interfacePropertyMapping- Throws:
QueryException
-
getType
public Type getType()
Description copied from interface:PropertyMappingGet the type of the thing containing the properties- Specified by:
getTypein interfacePropertyMapping
-
getName
public java.lang.String getName()
Description copied from interface:JoinableAn identifying name; a class name or collection role name.
-
getElementPersister
public EntityPersister getElementPersister()
Description copied from interface:QueryableCollectionGet 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:
getElementPersisterin interfaceQueryableCollection
-
isCollection
public boolean isCollection()
Description copied from interface:JoinableIs this instance actually a CollectionPersister?- Specified by:
isCollectionin interfaceJoinable
-
getCollectionSpaces
public java.io.Serializable[] getCollectionSpaces()
Description copied from interface:CollectionPersisterGet the "space" that holds the persistent state- Specified by:
getCollectionSpacesin interfaceCollectionPersister
-
generateDeleteString
protected abstract java.lang.String generateDeleteString()
-
generateDeleteRowString
protected abstract java.lang.String generateDeleteRowString()
-
generateUpdateRowString
protected abstract java.lang.String generateUpdateRowString()
-
generateInsertRowString
protected abstract java.lang.String generateInsertRowString()
-
updateRows
public void updateRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:CollectionPersisterUpdate the persistent state of any elements that were modified- Specified by:
updateRowsin interfaceCollectionPersister- Throws:
HibernateException
-
doUpdateRows
protected abstract int doUpdateRows(java.io.Serializable key, PersistentCollection collection, SharedSessionContractImplementor session) throws HibernateException- Throws:
HibernateException
-
processQueuedOps
public void processQueuedOps(PersistentCollection collection, java.io.Serializable key, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:CollectionPersisterProcess queued operations within the PersistentCollection.- Specified by:
processQueuedOpsin interfaceCollectionPersister- Throws:
HibernateException
-
doProcessQueuedOps
@Deprecated protected void doProcessQueuedOps(PersistentCollection collection, java.io.Serializable key, int nextIndex, SharedSessionContractImplementor session) throws HibernateException
Process queued operations within the PersistentCollection.- Parameters:
collection- The collectionkey- The collection keynextIndex- The next index to writesession- The session- Throws:
HibernateException
-
doProcessQueuedOps
protected abstract void doProcessQueuedOps(PersistentCollection collection, java.io.Serializable key, SharedSessionContractImplementor session) throws HibernateException
- Throws:
HibernateException
-
getCollectionMetadata
public CollectionMetadata getCollectionMetadata()
- Specified by:
getCollectionMetadatain interfaceCollectionPersister
-
getFactory
public SessionFactoryImplementor getFactory()
- Specified by:
getFactoryin interfaceCollectionPersister
-
filterFragment
protected java.lang.String filterFragment(java.lang.String alias) throws MappingException- Throws:
MappingException
-
filterFragment
protected java.lang.String filterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations) throws MappingException- Throws:
MappingException
-
filterFragment
public java.lang.String filterFragment(java.lang.String alias, java.util.Map enabledFilters) throws MappingExceptionDescription copied from interface:JoinableGet the where clause filter, given a query alias and considering enabled session filters- Specified by:
filterFragmentin interfaceJoinable- Throws:
MappingException
-
filterFragment
public java.lang.String filterFragment(java.lang.String alias, java.util.Map enabledFilters, java.util.Set<java.lang.String> treatAsDeclarations)Description copied from interface:JoinableGet the where clause filter, given a query alias and considering enabled session filters- Specified by:
filterFragmentin interfaceJoinable
-
oneToManyFilterFragment
public java.lang.String oneToManyFilterFragment(java.lang.String alias) throws MappingException- Specified by:
oneToManyFilterFragmentin interfaceJoinable- Throws:
MappingException
-
oneToManyFilterFragment
public java.lang.String oneToManyFilterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)- Specified by:
oneToManyFilterFragmentin interfaceJoinable
-
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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isVersioned
public boolean isVersioned()
Description copied from interface:CollectionPersisterDoes this collection cause version increment of the owning entity?- Specified by:
isVersionedin interfaceCollectionPersister
-
getSQLExceptionConverter
protected SQLExceptionConverter getSQLExceptionConverter()
-
getSQLExceptionHelper
protected SqlExceptionHelper getSQLExceptionHelper()
-
getCacheEntryStructure
public CacheEntryStructure getCacheEntryStructure()
Description copied from interface:CollectionPersisterGet the cache structure- Specified by:
getCacheEntryStructurein interfaceCollectionPersister
-
isAffectedByEnabledFilters
public boolean isAffectedByEnabledFilters(SharedSessionContractImplementor session)
- Specified by:
isAffectedByEnabledFiltersin interfaceCollectionPersister
-
isSubselectLoadable
public boolean isSubselectLoadable()
-
isMutable
public boolean isMutable()
Description copied from interface:CollectionPersisterCan the elements of this collection change?- Specified by:
isMutablein interfaceCollectionPersister
-
getCollectionPropertyColumnAliases
public java.lang.String[] getCollectionPropertyColumnAliases(java.lang.String propertyName, java.lang.String suffix)- Specified by:
getCollectionPropertyColumnAliasesin interfaceSQLLoadableCollection
-
initCollectionPropertyMap
public void initCollectionPropertyMap()
-
getSize
public int getSize(java.io.Serializable key, SharedSessionContractImplementor session)- Specified by:
getSizein interfaceCollectionPersister
-
indexExists
public boolean indexExists(java.io.Serializable key, java.lang.Object index, SharedSessionContractImplementor session)- Specified by:
indexExistsin interfaceCollectionPersister
-
elementExists
public boolean elementExists(java.io.Serializable key, java.lang.Object element, SharedSessionContractImplementor session)- Specified by:
elementExistsin interfaceCollectionPersister
-
getElementByIndex
public java.lang.Object getElementByIndex(java.io.Serializable key, java.lang.Object index, SharedSessionContractImplementor session, java.lang.Object owner)- Specified by:
getElementByIndexin interfaceCollectionPersister
-
isExtraLazy
public boolean isExtraLazy()
- Specified by:
isExtraLazyin interfaceCollectionPersister
-
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.
-
getBatchSize
public int getBatchSize()
- Specified by:
getBatchSizein interfaceCollectionPersister
-
getMappedByProperty
public java.lang.String getMappedByProperty()
- Specified by:
getMappedByPropertyin interfaceCollectionPersister- Returns:
- the name of the property this collection is mapped by
-
getFilterAliasGenerator
public abstract org.hibernate.internal.FilterAliasGenerator getFilterAliasGenerator(java.lang.String rootAlias)
-
getCollectionPersister
public CollectionPersister getCollectionPersister()
- Specified by:
getCollectionPersisterin interfaceCollectionDefinition
-
getIndexDefinition
public CollectionIndexDefinition getIndexDefinition()
- Specified by:
getIndexDefinitionin interfaceCollectionDefinition
-
getElementDefinition
public CollectionElementDefinition getElementDefinition()
- Specified by:
getElementDefinitionin interfaceCollectionDefinition
-
createInsert
protected Insert createInsert()
-
createUpdate
protected Update createUpdate()
-
createDelete
protected Delete createDelete()
-
-