Top Description Fields Constructors Methods
org.hibernate.persister.collection

public Class OneToManyPersister

extends AbstractCollectionPersister
Class Inheritance
Imports
java.io.Serializable, java.sql.PreparedStatement, .SQLException, java.util.Iterator, .Set, org.hibernate.HibernateException, .MappingException, org.hibernate.cache.CacheException, org.hibernate.cache.spi.access.CollectionDataAccess, org.hibernate.collection.spi.PersistentCollection, org.hibernate.engine.jdbc.batch.internal.BasicBatchKey, org.hibernate.engine.spi.LoadQueryInfluencers, .SharedSessionContractImplementor, .SubselectFetch, org.hibernate.internal.FilterAliasGenerator, org.hibernate.internal.util.collections.ArrayHelper, org.hibernate.jdbc.Expectation, .Expectations, org.hibernate.loader.collection.BatchingCollectionInitializerBuilder, .CollectionInitializer, .SubselectOneToManyLoader, org.hibernate.loader.entity.CollectionElementLoader, org.hibernate.mapping.Collection, org.hibernate.persister.entity.Joinable, .OuterJoinLoadable, org.hibernate.persister.spi.PersisterCreationContext, org.hibernate.pretty.MessageHelper, org.hibernate.sql.Update

Collection persister for one-to-many associations.
Authors
Gavin King, Brett Meyer

Field Summary

Modifier and TypeField and Description
private final boolean
private BasicBatchKey
private BasicBatchKey
private final boolean
private final boolean
Inherited from org.hibernate.persister.collection.AbstractCollectionPersister:
batchSizeelementColumnAliaseselementColumnIsGettableelementColumnIsInPrimaryKeyelementColumnIsSettableelementColumnNameselementColumnReaderselementColumnReaderTemplateselementColumnWriterselementFormulaselementFormulaTemplateselementIsPureFormulaelementTypehasIdentifierhasIndexhasWhereidentifierColumnNameindexColumnAliasesindexColumnIsGettableindexColumnIsSettableindexColumnNamesindexContainsFormulaindexFormulasindexFormulaTemplatesisInversekeyColumnAliaseskeyColumnNamesqualifiedTableNamerecreateBatchKeysqlExceptionHelpersqlWhereString

Constructor Summary

AccessConstructor and Description
public
OneToManyPersister(Collection collectionBinding, CollectionDataAccess cacheAccessStrategy, PersisterCreationContext creationContext)

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
protected CollectionInitializer
protected CollectionInitializer
protected void
protected int
public String
protected String
public String
fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)

Implements org.hibernate.persister.entity.Joinable.fromJoinFragment.

Get the from clause part of any joins (optional operation)
public String
fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)

Implements org.hibernate.persister.entity.Joinable.fromJoinFragment.

Get the from clause part of any joins (optional operation)
protected String
generateDeleteRowString()

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.generateDeleteRowString.

Generate the SQL UPDATE that updates a particular row's foreign key to null
protected String
generateDeleteString()

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.generateDeleteString.

Generate the SQL UPDATE that updates all the foreign keys to null
protected String
generateInsertRowString()

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.generateInsertRowString.

Generate the SQL UPDATE that updates a foreign key to a value
protected String
generateUpdateRowString()

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.generateUpdateRowString.

Generate the SQL UPDATE that inserts a collection index
public Object
public FilterAliasGenerator
public String
public void
public boolean
isCascadeDeleteEnabled()

Implements org.hibernate.persister.collection.CollectionPersister.isCascadeDeleteEnabled.

Is cascade delete handled by the database-level foreign key constraint definition?
public boolean
public boolean
protected boolean
protected boolean
public void
public String
selectFragment(Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)

Implements org.hibernate.persister.entity.Joinable.selectFragment.

All columns to select, when loading.
public String
whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)

Implements org.hibernate.persister.entity.Joinable.whereJoinFragment.

Get the where clause part of any joins (optional operation)
public String
whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)

Implements org.hibernate.persister.entity.Joinable.whereJoinFragment.

Get the where clause part of any joins (optional operation)
private void
writeIndex(PersistentCollection collection, Iterator<E> entries, Serializable id, boolean resetIndex, SharedSessionContractImplementor session)

Inherited from org.hibernate.persister.collection.AbstractCollectionPersister:
appendElementColumnsappendIdentifierColumnsappendIndexColumnscreateDeletecreateInsertcreateUpdatedecrementIndexByBasedeleteRowsdetermineTableNamedoProcessQueuedOpselementExistsfilterFragmentfilterFragmentgenerateDetectRowByElementStringgenerateDetectRowByIndexStringgenerateSelectFragmentgenerateSelectRowByIndexStringgenerateSelectSizeStringgetAppropriateInitializergetBatchSizegetCacheAccessStrategygetCacheEntryStructuregetCollectionMetadatagetCollectionPersistergetCollectionPropertyColumnAliasesgetCollectionSpacesgetCollectionTypegetDeleteAllCheckStylegetDeleteCheckStylegetDialectgetElementClassgetElementColumnAliasesgetElementColumnNamesgetElementColumnNamesgetElementDefinitiongetElementPersistergetElementTypegetFactorygetFetchModegetIdentifierColumnAliasgetIdentifierColumnNamegetIdentifierGeneratorgetIdentifierTypegetIndexColumnAliasesgetIndexColumnNamesgetIndexColumnNamesgetIndexDefinitiongetIndexFormulasgetIndexTypegetInitializergetInsertCheckStylegetKeyColumnAliasesgetKeyColumnNamesgetKeyTypegetManyToManyFilterFragmentgetManyToManyOrderByStringgetMappedByPropertygetNamegetNavigableRolegetOwnerEntityNamegetOwnerEntityPersistergetRolegetSizegetSQLDeleteRowStringgetSQLDeleteStringgetSQLExceptionConvertergetSQLExceptionHelpergetSQLInsertRowStringgetSQLOrderByStringgetSQLUpdateRowStringgetSQLWhereStringgetTypegetUpdateCheckStylehasCachehasIndexhasManyToManyOrderinghasOrderinghasOrphanDeletehasWhereincrementIndexByBaseindexExistsinitCollectionPropertyMapinitializeisAffectedByEnabledFiltersisArrayisCollectionisDeleteAllCallableisDeleteCallableisExtraLazyisInsertCallableisInverseisLazyisMutableisPrimitiveArrayisSubselectLoadableisUpdateCallableisVersionedlogStaticSQLoneToManyFilterFragmentoneToManyFilterFragmentpostInstantiateprocessQueuedOpsreadElementreadIdentifierreadIndexreadKeyremoveselectFragmenttoColumnstoColumnstoStringtoTypeupdateRowswriteElementwriteElementToWherewriteIdentifierwriteIndexwriteIndexToWherewriteKey

Field Detail

cascadeDeleteEnabledback to summary
private final boolean cascadeDeleteEnabled
deleteRowBatchKeyback to summary
private BasicBatchKey deleteRowBatchKey
insertRowBatchKeyback to summary
private BasicBatchKey insertRowBatchKey
keyIsNullableback to summary
private final boolean keyIsNullable
keyIsUpdateableback to summary
private final boolean keyIsUpdateable

Constructor Detail

OneToManyPersisterback to summary
public OneToManyPersister(Collection collectionBinding, CollectionDataAccess cacheAccessStrategy, PersisterCreationContext creationContext) throws MappingException, CacheException

Method Detail

consumesCollectionAliasback to summary
public boolean consumesCollectionAlias()

Implements org.hibernate.persister.entity.Joinable.consumesCollectionAlias.

Doc from org.hibernate.persister.entity.Joinable.consumesCollectionAlias.

Very, very, very ugly...

Returns:boolean

Does this persister "consume" collection column aliases in the result set?

consumesEntityAliasback to summary
public boolean consumesEntityAlias()

Implements org.hibernate.persister.entity.Joinable.consumesEntityAlias.

Doc from org.hibernate.persister.entity.Joinable.consumesEntityAlias.

Very, very, very ugly...

Returns:boolean

Does this persister "consume" entity column aliases in the result set?

createCollectionInitializerback to summary
protected CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers) throws MappingException

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.createCollectionInitializer.

Create the OneToManyLoader

Annotations
@Override
See Also
org.hibernate.loader.collection.OneToManyLoader
createSubselectInitializerback to summary
protected CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SharedSessionContractImplementor session)

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.createSubselectInitializer.

Annotations
@Override
doProcessQueuedOpsback to summary
protected void doProcessQueuedOps(PersistentCollection collection, Serializable id, SharedSessionContractImplementor session) throws HibernateException

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.doProcessQueuedOps.

Annotations
@Override
doUpdateRowsback to summary
protected int doUpdateRows(Serializable id, PersistentCollection collection, SharedSessionContractImplementor session)

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.doUpdateRows.

Annotations
@Override
filterFragmentback to summary
public String filterFragment(String alias) throws MappingException

Overrides org.hibernate.persister.collection.AbstractCollectionPersister.filterFragment.

Annotations
@Override
filterFragmentback to summary
protected String filterFragment(String alias, Set<String> treatAsDeclarations) throws MappingException

Overrides org.hibernate.persister.collection.AbstractCollectionPersister.filterFragment.

Annotations
@Override
fromJoinFragmentback to summary
public String fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)

Implements org.hibernate.persister.entity.Joinable.fromJoinFragment.

Doc from org.hibernate.persister.entity.Joinable.fromJoinFragment.

Get the from clause part of any joins (optional operation)

Annotations
@Override
fromJoinFragmentback to summary
public String fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)

Implements org.hibernate.persister.entity.Joinable.fromJoinFragment.

Doc from org.hibernate.persister.entity.Joinable.fromJoinFragment.

Get the from clause part of any joins (optional operation)

Annotations
@Override
generateDeleteRowStringback to summary
protected String generateDeleteRowString()

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.generateDeleteRowString.

Generate the SQL UPDATE that updates a particular row's foreign key to null

Annotations
@Override
generateDeleteStringback to summary
protected String generateDeleteString()

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.generateDeleteString.

Generate the SQL UPDATE that updates all the foreign keys to null

Annotations
@Override
generateInsertRowStringback to summary
protected String generateInsertRowString()

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.generateInsertRowString.

Generate the SQL UPDATE that updates a foreign key to a value

Annotations
@Override
generateUpdateRowStringback to summary
protected String generateUpdateRowString()

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.generateUpdateRowString.

Generate the SQL UPDATE that inserts a collection index

Annotations
@Override
getElementByIndexback to summary
public Object getElementByIndex(Serializable key, Object index, SharedSessionContractImplementor session, Object owner)

Overrides org.hibernate.persister.collection.AbstractCollectionPersister.getElementByIndex.

Implements org.hibernate.persister.collection.CollectionPersister.getElementByIndex.

Annotations
@Override
getFilterAliasGeneratorback to summary
public FilterAliasGenerator getFilterAliasGenerator(String rootAlias)

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.getFilterAliasGenerator.

Annotations
@Override
getTableNameback to summary
public String getTableName()

Overrides org.hibernate.persister.collection.AbstractCollectionPersister.getTableName.

Implements org.hibernate.persister.entity.Joinable.getTableName.

Doc from org.hibernate.persister.entity.Joinable.getTableName.

The table to join to.

Annotations
@Override
insertRowsback to summary
public void insertRows(PersistentCollection collection, Serializable id, SharedSessionContractImplementor session) throws HibernateException

Overrides org.hibernate.persister.collection.AbstractCollectionPersister.insertRows.

Implements org.hibernate.persister.collection.CollectionPersister.insertRows.

Doc from org.hibernate.persister.collection.CollectionPersister.insertRows.

Insert the persistent state of any new collection elements

Annotations
@Override
isCascadeDeleteEnabledback to summary
public boolean isCascadeDeleteEnabled()

Implements org.hibernate.persister.collection.CollectionPersister.isCascadeDeleteEnabled.

Doc from org.hibernate.persister.collection.CollectionPersister.isCascadeDeleteEnabled.

Is cascade delete handled by the database-level foreign key constraint definition?

isManyToManyback to summary
public boolean isManyToMany()

Implements abstract org.hibernate.persister.collection.AbstractCollectionPersister.isManyToMany.

Implements org.hibernate.persister.collection.CollectionPersister.isManyToMany.

Doc from org.hibernate.persister.collection.CollectionPersister.isManyToMany.

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.

Annotations
@Override
isOneToManyback to summary
public boolean isOneToMany()

Implements org.hibernate.persister.collection.CollectionPersister.isOneToMany.

Doc from org.hibernate.persister.collection.CollectionPersister.isOneToMany.

Is this a one-to-many association?

isRowDeleteEnabledback to summary
protected boolean isRowDeleteEnabled()

Overrides org.hibernate.persister.collection.AbstractCollectionPersister.isRowDeleteEnabled.

Annotations
@Override
isRowInsertEnabledback to summary
protected boolean isRowInsertEnabled()

Overrides org.hibernate.persister.collection.AbstractCollectionPersister.isRowInsertEnabled.

Annotations
@Override
recreateback to summary
public void recreate(PersistentCollection collection, Serializable id, SharedSessionContractImplementor session) throws HibernateException

Overrides org.hibernate.persister.collection.AbstractCollectionPersister.recreate.

Implements org.hibernate.persister.collection.CollectionPersister.recreate.

Doc from org.hibernate.persister.collection.CollectionPersister.recreate.

(Re)create the collection's persistent state

Annotations
@Override
selectFragmentback to summary
public String selectFragment(Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)

Implements org.hibernate.persister.entity.Joinable.selectFragment.

Doc from org.hibernate.persister.entity.Joinable.selectFragment.

All columns to select, when loading.

whereJoinFragmentback to summary
public String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)

Implements org.hibernate.persister.entity.Joinable.whereJoinFragment.

Doc from org.hibernate.persister.entity.Joinable.whereJoinFragment.

Get the where clause part of any joins (optional operation)

Annotations
@Override
whereJoinFragmentback to summary
public String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)

Implements org.hibernate.persister.entity.Joinable.whereJoinFragment.

Doc from org.hibernate.persister.entity.Joinable.whereJoinFragment.

Get the where clause part of any joins (optional operation)

Annotations
@Override
writeIndexback to summary
private void writeIndex(PersistentCollection collection, Iterator<E> entries, Serializable id, boolean resetIndex, SharedSessionContractImplementor session)