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 int
batchSize
protected java.lang.String[]
elementColumnAliases
protected boolean[]
elementColumnIsInPrimaryKey
protected boolean[]
elementColumnIsSettable
protected java.lang.String[]
elementColumnNames
protected java.lang.String[]
elementColumnReaders
protected java.lang.String[]
elementColumnReaderTemplates
protected java.lang.String[]
elementColumnWriters
protected java.lang.String[]
elementFormulas
protected java.lang.String[]
elementFormulaTemplates
protected boolean
elementIsPureFormula
protected Type
elementType
protected boolean
hasIdentifier
protected boolean
hasIndex
protected boolean
hasWhere
protected java.lang.String
identifierColumnName
protected java.lang.String[]
indexColumnAliases
protected boolean[]
indexColumnIsGettable
protected boolean[]
indexColumnIsSettable
protected java.lang.String[]
indexColumnNames
protected boolean
indexContainsFormula
protected java.lang.String[]
indexFormulas
protected java.lang.String[]
indexFormulaTemplates
protected boolean
isInverse
protected java.lang.String[]
keyColumnAliases
protected java.lang.String[]
keyColumnNames
protected java.lang.String
qualifiedTableName
protected org.hibernate.engine.jdbc.batch.internal.BasicBatchKey
recreateBatchKey
protected SqlExceptionHelper
sqlExceptionHelper
protected java.lang.String
sqlWhereString
-
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 void
appendElementColumns(SelectFragment frag, java.lang.String elemAlias)
protected void
appendIdentifierColumns(SelectFragment frag, java.lang.String alias)
protected void
appendIndexColumns(SelectFragment frag, java.lang.String alias)
protected abstract CollectionInitializer
createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
protected abstract CollectionInitializer
createSubselectInitializer(SubselectFetch subselect, SharedSessionContractImplementor session)
protected java.lang.Object
decrementIndexByBase(java.lang.Object index)
void
deleteRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)
Delete the persistent state of any elements that were removed from the collectionprotected java.lang.String
determineTableName(Table table, JdbcEnvironment jdbcEnvironment)
protected void
doProcessQueuedOps(PersistentCollection collection, java.io.Serializable key, int nextIndex, SharedSessionContractImplementor session)
protected abstract void
doProcessQueuedOps(PersistentCollection collection, java.io.Serializable key, SharedSessionContractImplementor session)
protected abstract int
doUpdateRows(java.io.Serializable key, PersistentCollection collection, SharedSessionContractImplementor session)
boolean
elementExists(java.io.Serializable key, java.lang.Object element, SharedSessionContractImplementor 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 filtersjava.lang.String
filterFragment(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.String
filterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)
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 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 CollectionInitializer
getAppropriateInitializer(java.io.Serializable key, SharedSessionContractImplementor session)
int
getBatchSize()
CollectionDataAccess
getCacheAccessStrategy()
Get the cacheCacheEntryStructure
getCacheEntryStructure()
Get the cache structureCollectionMetadata
getCollectionMetadata()
CollectionPersister
getCollectionPersister()
java.lang.String[]
getCollectionPropertyColumnAliases(java.lang.String propertyName, java.lang.String suffix)
java.io.Serializable[]
getCollectionSpaces()
Get the "space" that holds the persistent stateCollectionType
getCollectionType()
Get the associated Typeprotected ExecuteUpdateResultCheckStyle
getDeleteAllCheckStyle()
protected ExecuteUpdateResultCheckStyle
getDeleteCheckStyle()
protected Dialect
getDialect()
java.lang.Object
getElementByIndex(java.io.Serializable key, java.lang.Object index, SharedSessionContractImplementor 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 aliasCollectionElementDefinition
getElementDefinition()
EntityPersister
getElementPersister()
Get the persister of the element class, if this is a collection of entities (optional operation).Type
getElementType()
The collection element typeSessionFactoryImplementor
getFactory()
FetchMode
getFetchMode()
Should we load this collection role by outerjoining?abstract org.hibernate.internal.FilterAliasGenerator
getFilterAliasGenerator(java.lang.String rootAlias)
java.lang.String
getIdentifierColumnAlias(java.lang.String suffix)
Generates the collection's identifier column aliases, based on the given suffix.java.lang.String
getIdentifierColumnName()
IdentifierGenerator
getIdentifierGenerator()
Get the surrogate key generation strategy (optional operation)Type
getIdentifierType()
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 aliasCollectionIndexDefinition
getIndexDefinition()
java.lang.String[]
getIndexFormulas()
Get the index formulas if this is an indexed collection (optional operation)Type
getIndexType()
The collection index type (or null if the collection has no index)CollectionInitializer
getInitializer()
Intended for internal use only.protected ExecuteUpdateResultCheckStyle
getInsertCheckStyle()
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 onType
getKeyType()
The collection key typejava.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 manyjava.lang.String
getMappedByProperty()
java.lang.String
getName()
An identifying name; a class name or collection role name.NavigableRole
getNavigableRole()
java.lang.String
getOwnerEntityName()
EntityPersister
getOwnerEntityPersister()
Get the persister of the entity that "owns" this collectionjava.lang.String
getRole()
The name of this collection roleint
getSize(java.io.Serializable key, SharedSessionContractImplementor session)
protected java.lang.String
getSQLDeleteRowString()
protected java.lang.String
getSQLDeleteString()
protected SQLExceptionConverter
getSQLExceptionConverter()
protected SqlExceptionHelper
getSQLExceptionHelper()
protected java.lang.String
getSQLInsertRowString()
java.lang.String
getSQLOrderByString(java.lang.String alias)
Get the order by SQLprotected java.lang.String
getSQLUpdateRowString()
protected java.lang.String
getSQLWhereString(java.lang.String alias)
java.lang.String
getTableName()
The table to join to.Type
getType()
Get the type of the thing containing the propertiesprotected ExecuteUpdateResultCheckStyle
getUpdateCheckStyle()
boolean
hasCache()
Is this collection role cacheableboolean
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, SharedSessionContractImplementor session)
void
initCollectionPropertyMap()
void
initialize(java.io.Serializable key, SharedSessionContractImplementor session)
Initialize the given collection with the given key TODO: add owner argument!!void
insertRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)
Insert the persistent state of any new collection elementsboolean
isAffectedByEnabledFilters(SharedSessionContractImplementor 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)
java.lang.String
oneToManyFilterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)
void
postInstantiate()
void
processQueuedOps(PersistentCollection collection, java.io.Serializable key, SharedSessionContractImplementor session)
Process queued operations within the PersistentCollection.java.lang.Object
readElement(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.Object
readIdentifier(java.sql.ResultSet rs, java.lang.String alias, SharedSessionContractImplementor session)
Read the identifier from a row of the JDBC ResultSetjava.lang.Object
readIndex(java.sql.ResultSet rs, java.lang.String[] aliases, SharedSessionContractImplementor session)
Read the index from a row of the JDBC ResultSetjava.lang.Object
readKey(java.sql.ResultSet rs, java.lang.String[] aliases, SharedSessionContractImplementor session)
Read the key from a row of the JDBC ResultSetvoid
recreate(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)
(Re)create the collection's persistent statevoid
remove(java.io.Serializable id, SharedSessionContractImplementor session)
Completely remove the persistent state of the collectionjava.lang.String
selectFragment(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.String
toString()
Type
toType(java.lang.String propertyName)
Given a component path expression, get the type of the propertyvoid
updateRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)
Update the persistent state of any elements that were modifiedprotected int
writeElement(java.sql.PreparedStatement st, java.lang.Object elt, int i, SharedSessionContractImplementor session)
Write the element to a JDBC PreparedStatementprotected int
writeElementToWhere(java.sql.PreparedStatement st, java.lang.Object elt, int i, SharedSessionContractImplementor session)
Write the element to a JDBC PreparedStatementint
writeIdentifier(java.sql.PreparedStatement st, java.lang.Object id, int i, SharedSessionContractImplementor session)
Write the identifier to a JDBC PreparedStatementprotected int
writeIndex(java.sql.PreparedStatement st, java.lang.Object index, int i, SharedSessionContractImplementor session)
Write the index to a JDBC PreparedStatementprotected int
writeIndexToWhere(java.sql.PreparedStatement st, java.lang.Object index, int i, SharedSessionContractImplementor session)
Write the index to a JDBC PreparedStatementprotected int
writeKey(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, 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
-
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:
MappingException
CacheException
-
-
Method Detail
-
determineTableName
protected java.lang.String determineTableName(Table table, JdbcEnvironment jdbcEnvironment)
-
postInstantiate
public void postInstantiate() throws MappingException
- Specified by:
postInstantiate
in interfaceCollectionPersister
- Throws:
MappingException
-
logStaticSQL
protected void logStaticSQL()
-
initialize
public void initialize(java.io.Serializable key, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:CollectionPersister
Initialize the given collection with the given key TODO: add owner argument!!- Specified by:
initialize
in 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:
getNavigableRole
in interfaceCollectionPersister
-
getCacheAccessStrategy
public CollectionDataAccess getCacheAccessStrategy()
Description copied from interface:CollectionPersister
Get the cache- Specified by:
getCacheAccessStrategy
in interfaceCollectionPersister
-
hasCache
public boolean hasCache()
Description copied from interface:CollectionPersister
Is this collection role cacheable- Specified by:
hasCache
in interfaceCollectionPersister
-
getCollectionType
public CollectionType getCollectionType()
Description copied from interface:CollectionPersister
Get the associated Type- Specified by:
getCollectionType
in interfaceCollectionDefinition
- Specified by:
getCollectionType
in 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:QueryableCollection
Get the order by SQL- Specified by:
getSQLOrderByString
in interfaceQueryableCollection
-
getManyToManyOrderByString
public java.lang.String getManyToManyOrderByString(java.lang.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 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:QueryableCollection
Should we load this collection role by outerjoining?- Specified by:
getFetchMode
in interfaceQueryableCollection
-
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 interfaceCollectionPersister
-
hasManyToManyOrdering
public boolean hasManyToManyOrdering()
- Specified by:
hasManyToManyOrdering
in interfaceCollectionPersister
-
hasWhere
public boolean hasWhere()
Description copied from interface:QueryableCollection
Does this collection role have a where clause filter?- Specified by:
hasWhere
in 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:CollectionMetadata
The collection key type- Specified by:
getKeyType
in interfaceCollectionMetadata
- Specified by:
getKeyType
in interfaceCollectionPersister
-
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 interfaceCollectionMetadata
- Specified by:
getIndexType
in interfaceCollectionPersister
-
getElementType
public Type getElementType()
Description copied from interface:CollectionMetadata
The collection element type- Specified by:
getElementType
in interfaceCollectionMetadata
- Specified by:
getElementType
in interfaceCollectionPersister
-
getElementClass
public java.lang.Class getElementClass()
Return the element class of an array, or null otherwise. needed by arrays- Specified by:
getElementClass
in 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.SQLException
Description copied from interface:CollectionPersister
Read the element from a row of the JDBC ResultSet- Specified by:
readElement
in interfaceCollectionPersister
- Throws:
HibernateException
java.sql.SQLException
-
readIndex
public java.lang.Object readIndex(java.sql.ResultSet rs, java.lang.String[] aliases, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLException
Description copied from interface:CollectionPersister
Read the index from a row of the JDBC ResultSet- Specified by:
readIndex
in interfaceCollectionPersister
- Throws:
HibernateException
java.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.SQLException
Description copied from interface:CollectionPersister
Read the identifier from a row of the JDBC ResultSet- Specified by:
readIdentifier
in interfaceCollectionPersister
- Throws:
HibernateException
java.sql.SQLException
-
readKey
public java.lang.Object readKey(java.sql.ResultSet rs, java.lang.String[] aliases, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLException
Description copied from interface:CollectionPersister
Read the key from a row of the JDBC ResultSet- Specified by:
readKey
in interfaceCollectionPersister
- Throws:
HibernateException
java.sql.SQLException
-
writeKey
protected int writeKey(java.sql.PreparedStatement st, java.io.Serializable key, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLException
Write the key to a JDBC PreparedStatement- Throws:
HibernateException
java.sql.SQLException
-
writeElement
protected int writeElement(java.sql.PreparedStatement st, java.lang.Object elt, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLException
Write the element to a JDBC PreparedStatement- Throws:
HibernateException
java.sql.SQLException
-
writeIndex
protected int writeIndex(java.sql.PreparedStatement st, java.lang.Object index, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLException
Write the index to a JDBC PreparedStatement- Throws:
HibernateException
java.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.SQLException
Write the element to a JDBC PreparedStatement- Throws:
HibernateException
java.sql.SQLException
-
writeIndexToWhere
protected int writeIndexToWhere(java.sql.PreparedStatement st, java.lang.Object index, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLException
Write the index to a JDBC PreparedStatement- Throws:
HibernateException
java.sql.SQLException
-
writeIdentifier
public int writeIdentifier(java.sql.PreparedStatement st, java.lang.Object id, int i, SharedSessionContractImplementor session) throws HibernateException, java.sql.SQLException
Write the identifier to a JDBC PreparedStatement- Throws:
HibernateException
java.sql.SQLException
-
isPrimitiveArray
public boolean isPrimitiveArray()
Description copied from interface:CollectionMetadata
Is the collection a primitive array?- Specified by:
isPrimitiveArray
in interfaceCollectionMetadata
- Specified by:
isPrimitiveArray
in interfaceCollectionPersister
-
isArray
public boolean isArray()
Description copied from interface:CollectionMetadata
Is the collection an array?- Specified by:
isArray
in interfaceCollectionMetadata
- Specified by:
isArray
in interfaceCollectionPersister
-
getKeyColumnAliases
public java.lang.String[] getKeyColumnAliases(java.lang.String suffix)
Description copied from interface:CollectionPersister
Generates the collection's key column aliases, based on the given suffix.- Specified by:
getKeyColumnAliases
in 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:CollectionPersister
Generates the collection's element column aliases, based on the given suffix.- Specified by:
getElementColumnAliases
in 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:CollectionPersister
Generates the collection's index column aliases, based on the given suffix.- Specified by:
getIndexColumnAliases
in 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:CollectionPersister
Generates the collection's identifier column aliases, based on the given suffix.- Specified by:
getIdentifierColumnAlias
in 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:
getIdentifierColumnName
in 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:
selectFragment
in 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:QueryableCollection
Get the names of the collection index columns if this is an indexed collection (optional operation)- Specified by:
getIndexColumnNames
in interfaceQueryableCollection
-
getIndexFormulas
public java.lang.String[] getIndexFormulas()
Description copied from interface:QueryableCollection
Get the index formulas if this is an indexed collection (optional operation)- Specified by:
getIndexFormulas
in interfaceQueryableCollection
-
getIndexColumnNames
public java.lang.String[] getIndexColumnNames(java.lang.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 interfaceQueryableCollection
-
getElementColumnNames
public java.lang.String[] getElementColumnNames(java.lang.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 interfaceQueryableCollection
-
getElementColumnNames
public java.lang.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 interfaceQueryableCollection
-
getKeyColumnNames
public java.lang.String[] getKeyColumnNames()
Description copied from interface:Joinable
The columns to join on- Specified by:
getKeyColumnNames
in interfaceJoinable
-
hasIndex
public boolean hasIndex()
Description copied from interface:CollectionMetadata
Is this collection indexed?- Specified by:
hasIndex
in interfaceCollectionMetadata
- Specified by:
hasIndex
in interfaceCollectionPersister
-
isLazy
public boolean isLazy()
Description copied from interface:CollectionMetadata
Is the collection lazily initialized?- Specified by:
isLazy
in interfaceCollectionMetadata
- Specified by:
isLazy
in interfaceCollectionPersister
-
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 interfaceCollectionPersister
-
getTableName
public java.lang.String getTableName()
Description copied from interface:Joinable
The table to join to.- Specified by:
getTableName
in interfaceJoinable
-
remove
public void remove(java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:CollectionPersister
Completely remove the persistent state of the collection- Specified by:
remove
in 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:
recreate
in 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:CollectionPersister
Delete the persistent state of any elements that were removed from the collection- Specified by:
deleteRows
in 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:CollectionPersister
Insert the persistent state of any new collection elements- Specified by:
insertRows
in interfaceCollectionPersister
- Throws:
HibernateException
-
getRole
public java.lang.String getRole()
Description copied from interface:CollectionMetadata
The name of this collection role- Specified by:
getRole
in interfaceCollectionMetadata
- Specified by:
getRole
in interfaceCollectionPersister
-
getOwnerEntityName
public java.lang.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 interfaceCollectionPersister
-
getIdentifierGenerator
public IdentifierGenerator getIdentifierGenerator()
Description copied from interface:CollectionPersister
Get the surrogate key generation strategy (optional operation)- Specified by:
getIdentifierGenerator
in interfaceCollectionPersister
-
getIdentifierType
public Type getIdentifierType()
Description copied from interface:CollectionPersister
Get the type of the surrogate key- Specified by:
getIdentifierType
in interfaceCollectionPersister
-
hasOrphanDelete
public boolean hasOrphanDelete()
Description copied from interface:CollectionPersister
Does this collection implement "orphan delete"?- Specified by:
hasOrphanDelete
in interfaceCollectionPersister
-
toType
public Type toType(java.lang.String propertyName) throws QueryException
Description copied from interface:PropertyMapping
Given a component path expression, get the type of the property- Specified by:
toType
in interfacePropertyMapping
- 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 interfaceCollectionPersister
-
getManyToManyFilterFragment
public java.lang.String getManyToManyFilterFragment(java.lang.String alias, java.util.Map enabledFilters)
- Specified by:
getManyToManyFilterFragment
in interfaceCollectionPersister
-
toColumns
public java.lang.String[] toColumns(java.lang.String alias, java.lang.String propertyName) throws QueryException
Description copied from interface:PropertyMapping
Obtain aliased column/formula fragments for the specified property path.- Specified by:
toColumns
in interfacePropertyMapping
- Throws:
QueryException
-
toColumns
public java.lang.String[] toColumns(java.lang.String propertyName) throws QueryException
Description copied from interface:PropertyMapping
Given a property path, return the corresponding column name(s).- Specified by:
toColumns
in interfacePropertyMapping
- Throws:
QueryException
-
getType
public Type getType()
Description copied from interface:PropertyMapping
Get the type of the thing containing the properties- Specified by:
getType
in interfacePropertyMapping
-
getName
public java.lang.String getName()
Description copied from interface:Joinable
An identifying name; a class name or collection role name.
-
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 interfaceQueryableCollection
-
isCollection
public boolean isCollection()
Description copied from interface:Joinable
Is this instance actually a CollectionPersister?- Specified by:
isCollection
in interfaceJoinable
-
getCollectionSpaces
public java.io.Serializable[] getCollectionSpaces()
Description copied from interface:CollectionPersister
Get the "space" that holds the persistent state- Specified by:
getCollectionSpaces
in 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:CollectionPersister
Update the persistent state of any elements that were modified- Specified by:
updateRows
in 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:CollectionPersister
Process queued operations within the PersistentCollection.- Specified by:
processQueuedOps
in 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:
getCollectionMetadata
in interfaceCollectionPersister
-
getFactory
public SessionFactoryImplementor getFactory()
- Specified by:
getFactory
in 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 MappingException
Description copied from interface:Joinable
Get the where clause filter, given a query alias and considering enabled session filters- Specified by:
filterFragment
in 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:Joinable
Get the where clause filter, given a query alias and considering enabled session filters- Specified by:
filterFragment
in interfaceJoinable
-
oneToManyFilterFragment
public java.lang.String oneToManyFilterFragment(java.lang.String alias) throws MappingException
- Specified by:
oneToManyFilterFragment
in interfaceJoinable
- Throws:
MappingException
-
oneToManyFilterFragment
public java.lang.String oneToManyFilterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)
- Specified by:
oneToManyFilterFragment
in 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:
toString
in classjava.lang.Object
-
isVersioned
public boolean isVersioned()
Description copied from interface:CollectionPersister
Does this collection cause version increment of the owning entity?- Specified by:
isVersioned
in interfaceCollectionPersister
-
getSQLExceptionConverter
protected SQLExceptionConverter getSQLExceptionConverter()
-
getSQLExceptionHelper
protected SqlExceptionHelper getSQLExceptionHelper()
-
getCacheEntryStructure
public CacheEntryStructure getCacheEntryStructure()
Description copied from interface:CollectionPersister
Get the cache structure- Specified by:
getCacheEntryStructure
in interfaceCollectionPersister
-
isAffectedByEnabledFilters
public boolean isAffectedByEnabledFilters(SharedSessionContractImplementor session)
- Specified by:
isAffectedByEnabledFilters
in interfaceCollectionPersister
-
isSubselectLoadable
public boolean isSubselectLoadable()
-
isMutable
public boolean isMutable()
Description copied from interface:CollectionPersister
Can the elements of this collection change?- Specified by:
isMutable
in interfaceCollectionPersister
-
getCollectionPropertyColumnAliases
public java.lang.String[] getCollectionPropertyColumnAliases(java.lang.String propertyName, java.lang.String suffix)
- Specified by:
getCollectionPropertyColumnAliases
in interfaceSQLLoadableCollection
-
initCollectionPropertyMap
public void initCollectionPropertyMap()
-
getSize
public int getSize(java.io.Serializable key, SharedSessionContractImplementor session)
- Specified by:
getSize
in interfaceCollectionPersister
-
indexExists
public boolean indexExists(java.io.Serializable key, java.lang.Object index, SharedSessionContractImplementor session)
- Specified by:
indexExists
in interfaceCollectionPersister
-
elementExists
public boolean elementExists(java.io.Serializable key, java.lang.Object element, SharedSessionContractImplementor session)
- Specified by:
elementExists
in interfaceCollectionPersister
-
getElementByIndex
public java.lang.Object getElementByIndex(java.io.Serializable key, java.lang.Object index, SharedSessionContractImplementor session, java.lang.Object owner)
- Specified by:
getElementByIndex
in interfaceCollectionPersister
-
isExtraLazy
public boolean isExtraLazy()
- Specified by:
isExtraLazy
in 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:
getBatchSize
in interfaceCollectionPersister
-
getMappedByProperty
public java.lang.String getMappedByProperty()
- Specified by:
getMappedByProperty
in 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:
getCollectionPersister
in interfaceCollectionDefinition
-
getIndexDefinition
public CollectionIndexDefinition getIndexDefinition()
- Specified by:
getIndexDefinition
in interfaceCollectionDefinition
-
getElementDefinition
public CollectionElementDefinition getElementDefinition()
- Specified by:
getElementDefinition
in interfaceCollectionDefinition
-
-