Class OneToManyPersister
- java.lang.Object
-
- org.hibernate.persister.collection.AbstractCollectionPersister
-
- org.hibernate.persister.collection.OneToManyPersister
-
- All Implemented Interfaces:
CollectionMetadata
,CollectionPersister
,QueryableCollection
,SQLLoadableCollection
,Joinable
,PropertyMapping
,CollectionDefinition
public class OneToManyPersister extends AbstractCollectionPersister
Collection persister for one-to-many associations.
-
-
Field Summary
-
Fields inherited from class org.hibernate.persister.collection.AbstractCollectionPersister
batchSize, elementColumnAliases, elementColumnIsInPrimaryKey, elementColumnIsSettable, elementColumnNames, elementColumnReaders, elementColumnReaderTemplates, elementColumnWriters, elementFormulas, elementFormulaTemplates, elementIsPureFormula, elementType, hasIdentifier, hasIndex, hasWhere, identifierColumnName, indexColumnAliases, indexColumnIsGettable, indexColumnIsSettable, indexColumnNames, indexContainsFormula, indexFormulas, indexFormulaTemplates, isInverse, keyColumnAliases, keyColumnNames, qualifiedTableName, recreateBatchKey, sqlExceptionHelper, sqlWhereString
-
-
Constructor Summary
Constructors Constructor Description OneToManyPersister(Collection collectionBinding, CollectionDataAccess cacheAccessStrategy, PersisterCreationContext creationContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
consumesCollectionAlias()
Very, very, very ugly...boolean
consumesEntityAlias()
Very, very, very ugly...protected CollectionInitializer
createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
Create the OneToManyLoaderprotected CollectionInitializer
createSubselectInitializer(SubselectFetch subselect, SharedSessionContractImplementor session)
protected void
doProcessQueuedOps(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)
protected int
doUpdateRows(java.io.Serializable id, PersistentCollection collection, SharedSessionContractImplementor session)
java.lang.String
filterFragment(java.lang.String alias)
protected java.lang.String
filterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)
java.lang.String
fromJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses)
Get the from clause part of any joins (optional operation)java.lang.String
fromJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations)
Get the from clause part of any joins (optional operation)protected java.lang.String
generateDeleteRowString()
Generate the SQL UPDATE that updates a particular row's foreign key to nullprotected java.lang.String
generateDeleteString()
Generate the SQL UPDATE that updates all the foreign keys to nullprotected java.lang.String
generateInsertRowString()
Generate the SQL UPDATE that updates a foreign key to a valueprotected java.lang.String
generateUpdateRowString()
Generate the SQL UPDATE that inserts a collection indexjava.lang.Object
getElementByIndex(java.io.Serializable key, java.lang.Object index, SharedSessionContractImplementor session, java.lang.Object owner)
org.hibernate.internal.FilterAliasGenerator
getFilterAliasGenerator(java.lang.String rootAlias)
java.lang.String
getTableName()
The table to join to.void
insertRows(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)
Insert the persistent state of any new collection elementsboolean
isCascadeDeleteEnabled()
Is cascade delete handled by the database-level foreign key constraint definition?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
isOneToMany()
Is this a one-to-many association?protected boolean
isRowDeleteEnabled()
protected boolean
isRowInsertEnabled()
void
recreate(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session)
(Re)create the collection's persistent statejava.lang.String
selectFragment(Joinable rhs, java.lang.String rhsAlias, java.lang.String lhsAlias, java.lang.String entitySuffix, java.lang.String collectionSuffix, boolean includeCollectionColumns)
All columns to select, when loading.java.lang.String
whereJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses)
Get the where clause part of any joins (optional operation)java.lang.String
whereJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations)
Get the where clause part of any joins (optional operation)-
Methods inherited from class org.hibernate.persister.collection.AbstractCollectionPersister
appendElementColumns, appendIdentifierColumns, appendIndexColumns, decrementIndexByBase, deleteRows, determineTableName, doProcessQueuedOps, elementExists, filterFragment, filterFragment, generateDetectRowByElementString, generateDetectRowByIndexString, generateSelectFragment, generateSelectRowByIndexString, generateSelectSizeString, getAppropriateInitializer, getBatchSize, getCacheAccessStrategy, getCacheEntryStructure, getCollectionMetadata, getCollectionPersister, getCollectionPropertyColumnAliases, getCollectionSpaces, getCollectionType, getDeleteAllCheckStyle, getDeleteCheckStyle, getDialect, getElementClass, getElementColumnAliases, getElementColumnNames, getElementColumnNames, getElementDefinition, getElementPersister, getElementType, getFactory, getFetchMode, getIdentifierColumnAlias, getIdentifierColumnName, getIdentifierGenerator, getIdentifierType, getIndexColumnAliases, getIndexColumnNames, getIndexColumnNames, getIndexDefinition, getIndexFormulas, getIndexType, getInitializer, getInsertCheckStyle, getKeyColumnAliases, getKeyColumnNames, getKeyType, getManyToManyFilterFragment, getManyToManyOrderByString, getMappedByProperty, getName, getNavigableRole, getOwnerEntityName, getOwnerEntityPersister, getRole, getSize, getSQLDeleteRowString, getSQLDeleteString, getSQLExceptionConverter, getSQLExceptionHelper, getSQLInsertRowString, getSQLOrderByString, getSQLUpdateRowString, getSQLWhereString, getType, getUpdateCheckStyle, hasCache, hasIndex, hasManyToManyOrdering, hasOrdering, hasOrphanDelete, hasWhere, incrementIndexByBase, indexExists, initCollectionPropertyMap, initialize, isAffectedByEnabledFilters, isArray, isCollection, isDeleteAllCallable, isDeleteCallable, isExtraLazy, isInsertCallable, isInverse, isLazy, isMutable, isPrimitiveArray, isSubselectLoadable, isUpdateCallable, isVersioned, logStaticSQL, oneToManyFilterFragment, oneToManyFilterFragment, postInstantiate, processQueuedOps, readElement, readIdentifier, readIndex, readKey, remove, selectFragment, toColumns, toColumns, toString, toType, updateRows, writeElement, writeElementToWhere, writeIdentifier, writeIndex, writeIndexToWhere, writeKey
-
-
-
-
Constructor Detail
-
OneToManyPersister
public OneToManyPersister(Collection collectionBinding, CollectionDataAccess cacheAccessStrategy, PersisterCreationContext creationContext) throws MappingException, CacheException
- Throws:
MappingException
CacheException
-
-
Method Detail
-
isRowDeleteEnabled
protected boolean isRowDeleteEnabled()
- Overrides:
isRowDeleteEnabled
in classAbstractCollectionPersister
-
isRowInsertEnabled
protected boolean isRowInsertEnabled()
- Overrides:
isRowInsertEnabled
in classAbstractCollectionPersister
-
isCascadeDeleteEnabled
public boolean isCascadeDeleteEnabled()
Description copied from interface:CollectionPersister
Is cascade delete handled by the database-level foreign key constraint definition?
-
generateDeleteString
protected java.lang.String generateDeleteString()
Generate the SQL UPDATE that updates all the foreign keys to null- Specified by:
generateDeleteString
in classAbstractCollectionPersister
-
generateInsertRowString
protected java.lang.String generateInsertRowString()
Generate the SQL UPDATE that updates a foreign key to a value- Specified by:
generateInsertRowString
in classAbstractCollectionPersister
-
generateUpdateRowString
protected java.lang.String generateUpdateRowString()
Generate the SQL UPDATE that inserts a collection index- Specified by:
generateUpdateRowString
in classAbstractCollectionPersister
-
generateDeleteRowString
protected java.lang.String generateDeleteRowString()
Generate the SQL UPDATE that updates a particular row's foreign key to null- Specified by:
generateDeleteRowString
in classAbstractCollectionPersister
-
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
- Overrides:
recreate
in classAbstractCollectionPersister
- Throws:
HibernateException
-
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
- Overrides:
insertRows
in classAbstractCollectionPersister
- Throws:
HibernateException
-
doProcessQueuedOps
protected void doProcessQueuedOps(PersistentCollection collection, java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateException
- Specified by:
doProcessQueuedOps
in classAbstractCollectionPersister
- Throws:
HibernateException
-
consumesEntityAlias
public boolean consumesEntityAlias()
Description copied from interface:Joinable
Very, very, very ugly...- Returns:
- Does this persister "consume" entity column aliases in the result set?
-
consumesCollectionAlias
public boolean consumesCollectionAlias()
Description copied from interface:Joinable
Very, very, very ugly...- Returns:
- Does this persister "consume" collection column aliases in the result set?
-
isOneToMany
public boolean isOneToMany()
Description copied from interface:CollectionPersister
Is this a one-to-many association?
-
isManyToMany
public 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
- Specified by:
isManyToMany
in classAbstractCollectionPersister
-
doUpdateRows
protected int doUpdateRows(java.io.Serializable id, PersistentCollection collection, SharedSessionContractImplementor session)
- Specified by:
doUpdateRows
in classAbstractCollectionPersister
-
selectFragment
public java.lang.String selectFragment(Joinable rhs, java.lang.String rhsAlias, java.lang.String lhsAlias, java.lang.String entitySuffix, java.lang.String collectionSuffix, boolean includeCollectionColumns)
Description copied from interface:Joinable
All columns to select, when loading.
-
createCollectionInitializer
protected CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers) throws MappingException
Create the OneToManyLoader- Specified by:
createCollectionInitializer
in classAbstractCollectionPersister
- Throws:
MappingException
- See Also:
OneToManyLoader
-
fromJoinFragment
public java.lang.String fromJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses)
Description copied from interface:Joinable
Get the from clause part of any joins (optional operation)
-
fromJoinFragment
public java.lang.String fromJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations)
Description copied from interface:Joinable
Get the from clause part of any joins (optional operation)
-
whereJoinFragment
public java.lang.String whereJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses)
Description copied from interface:Joinable
Get the where clause part of any joins (optional operation)
-
whereJoinFragment
public java.lang.String whereJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations)
Description copied from interface:Joinable
Get the where clause part of any joins (optional operation)
-
getTableName
public java.lang.String getTableName()
Description copied from interface:Joinable
The table to join to.- Specified by:
getTableName
in interfaceJoinable
- Overrides:
getTableName
in classAbstractCollectionPersister
-
filterFragment
public java.lang.String filterFragment(java.lang.String alias) throws MappingException
- Overrides:
filterFragment
in classAbstractCollectionPersister
- Throws:
MappingException
-
filterFragment
protected java.lang.String filterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations) throws MappingException
- Overrides:
filterFragment
in classAbstractCollectionPersister
- Throws:
MappingException
-
createSubselectInitializer
protected CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SharedSessionContractImplementor session)
- Specified by:
createSubselectInitializer
in classAbstractCollectionPersister
-
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
- Overrides:
getElementByIndex
in classAbstractCollectionPersister
-
getFilterAliasGenerator
public org.hibernate.internal.FilterAliasGenerator getFilterAliasGenerator(java.lang.String rootAlias)
- Specified by:
getFilterAliasGenerator
in classAbstractCollectionPersister
-
-