org.hibernate.persister.collection
Class OneToManyPersister

java.lang.Object
  extended by org.hibernate.persister.collection.AbstractCollectionPersister
      extended by org.hibernate.persister.collection.OneToManyPersister
All Implemented Interfaces:
CollectionMetadata, CollectionPersister, QueryableCollection, SQLLoadableCollection, Joinable, PropertyMapping

public class OneToManyPersister
extends AbstractCollectionPersister

Collection persister for one-to-many associations.

Author:
Gavin King

Field Summary
 
Fields inherited from class org.hibernate.persister.collection.AbstractCollectionPersister
batchSize, elementColumnAliases, elementColumnIsInPrimaryKey, elementColumnIsSettable, elementColumnNames, elementFormulas, elementFormulaTemplates, elementIsPureFormula, elementType, hasIdentifier, hasIndex, hasWhere, identifierColumnName, indexColumnAliases, indexColumnIsSettable, indexColumnNames, indexContainsFormula, indexFormulas, indexFormulaTemplates, keyColumnAliases, keyColumnNames, qualifiedTableName, sqlWhereString
 
Constructor Summary
OneToManyPersister(Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory)
           
 
Method Summary
 boolean consumesCollectionAlias()
          Very, very, very ugly...
 boolean consumesEntityAlias()
          Very, very, very ugly...
protected  CollectionInitializer createCollectionInitializer(Map enabledFilters)
          Create the OneToManyLoader
protected  CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session)
           
protected  int doUpdateRows(Serializable id, PersistentCollection collection, SessionImplementor session)
           
 String filterFragment(String alias)
           
 String fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
          Get the from clause part of any joins (optional operation)
protected  String generateDeleteRowString()
          Generate the SQL UPDATE that updates a particular row's foreign key to null
protected  String generateDeleteString()
          Generate the SQL UPDATE that updates all the foreign keys to null
protected  String generateInsertRowString()
          Generate the SQL UPDATE that updates a foreign key to a value
protected  String generateUpdateRowString()
          Not needed for one-to-many association
 Object getElementByIndex(Serializable key, Object index, SessionImplementor session, Object owner)
           
 String getTableName()
          The table to join to.
 boolean 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()
           
 String selectFragment(Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)
          All columns to select, when loading.
 String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
          Get the where clause part of any joins (optional operation)
 
Methods inherited from class org.hibernate.persister.collection.AbstractCollectionPersister
appendElementColumns, appendIdentifierColumns, appendIndexColumns, decrementIndexByBase, deleteRows, elementExists, filterFragment, generateDetectRowByElementString, generateDetectRowByIndexString, generateSelectFragment, generateSelectRowByIndexString, generateSelectSizeString, getAppropriateInitializer, getCacheAccessStrategy, getCacheEntryStructure, getCollectionMetadata, getCollectionPropertyColumnAliases, getCollectionSpaces, getCollectionType, getDeleteAllCheckStyle, getDeleteCheckStyle, getDialect, getElementClass, getElementColumnAliases, getElementColumnNames, getElementColumnNames, getElementNodeName, getElementPersister, getElementType, getFactory, getFetchMode, getIdentifierColumnAlias, getIdentifierColumnName, getIdentifierGenerator, getIdentifierType, getIndexColumnAliases, getIndexColumnNames, getIndexColumnNames, getIndexFormulas, getIndexNodeName, getIndexType, getInsertCheckStyle, getKeyColumnAliases, getKeyColumnNames, getKeyType, getManyToManyFilterFragment, getManyToManyOrderByString, getName, getNodeName, getOwnerEntityName, getOwnerEntityPersister, getRole, getSize, getSQLDeleteRowString, getSQLDeleteString, getSQLExceptionConverter, getSQLInsertRowString, getSQLOrderByString, getSQLUpdateRowString, getSQLWhereString, getType, getUpdateCheckStyle, hasCache, hasIndex, hasManyToManyOrdering, hasOrdering, hasOrphanDelete, hasWhere, incrementIndexByBase, indexExists, initCollectionPropertyMap, initialize, insertRows, isAffectedByEnabledFilters, isArray, isCollection, isDeleteAllCallable, isDeleteCallable, isExtraLazy, isInsertCallable, isInverse, isLazy, isMutable, isPrimitiveArray, isSubselectLoadable, isUpdateCallable, isVersioned, logStaticSQL, oneToManyFilterFragment, postInstantiate, readElement, readIdentifier, readIndex, readKey, recreate, remove, selectFragment, toColumns, toColumns, toString, toType, updateRows, writeElement, writeElementToWhere, writeIdentifier, writeIndex, writeIndexToWhere, writeKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OneToManyPersister

public OneToManyPersister(Collection collection,
                          CollectionRegionAccessStrategy cacheAccessStrategy,
                          Configuration cfg,
                          SessionFactoryImplementor factory)
                   throws MappingException,
                          CacheException
Throws:
MappingException
CacheException
Method Detail

isRowDeleteEnabled

protected boolean isRowDeleteEnabled()
Overrides:
isRowDeleteEnabled in class AbstractCollectionPersister

isRowInsertEnabled

protected boolean isRowInsertEnabled()
Overrides:
isRowInsertEnabled in class AbstractCollectionPersister

isCascadeDeleteEnabled

public boolean isCascadeDeleteEnabled()
Description copied from interface: CollectionPersister
Is cascade delete handled by the database-level foreign key constraint definition?


generateDeleteString

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

Specified by:
generateDeleteString in class AbstractCollectionPersister

generateInsertRowString

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

Specified by:
generateInsertRowString in class AbstractCollectionPersister

generateUpdateRowString

protected String generateUpdateRowString()
Not needed for one-to-many association

Specified by:
generateUpdateRowString in class AbstractCollectionPersister

generateDeleteRowString

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

Specified by:
generateDeleteRowString in class AbstractCollectionPersister

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 interface CollectionPersister
Specified by:
isManyToMany in class AbstractCollectionPersister

doUpdateRows

protected int doUpdateRows(Serializable id,
                           PersistentCollection collection,
                           SessionImplementor session)
                    throws HibernateException
Specified by:
doUpdateRows in class AbstractCollectionPersister
Throws:
HibernateException

selectFragment

public String selectFragment(Joinable rhs,
                             String rhsAlias,
                             String lhsAlias,
                             String entitySuffix,
                             String collectionSuffix,
                             boolean includeCollectionColumns)
Description copied from interface: Joinable
All columns to select, when loading.


createCollectionInitializer

protected CollectionInitializer createCollectionInitializer(Map enabledFilters)
                                                     throws MappingException
Create the OneToManyLoader

Specified by:
createCollectionInitializer in class AbstractCollectionPersister
Throws:
MappingException
See Also:
OneToManyLoader

fromJoinFragment

public String fromJoinFragment(String alias,
                               boolean innerJoin,
                               boolean includeSubclasses)
Description copied from interface: Joinable
Get the from clause part of any joins (optional operation)


whereJoinFragment

public String whereJoinFragment(String alias,
                                boolean innerJoin,
                                boolean includeSubclasses)
Description copied from interface: Joinable
Get the where clause part of any joins (optional operation)


getTableName

public String getTableName()
Description copied from interface: Joinable
The table to join to.

Specified by:
getTableName in interface Joinable
Overrides:
getTableName in class AbstractCollectionPersister

filterFragment

public String filterFragment(String alias)
                      throws MappingException
Overrides:
filterFragment in class AbstractCollectionPersister
Throws:
MappingException

createSubselectInitializer

protected CollectionInitializer createSubselectInitializer(SubselectFetch subselect,
                                                           SessionImplementor session)
Specified by:
createSubselectInitializer in class AbstractCollectionPersister

getElementByIndex

public Object getElementByIndex(Serializable key,
                                Object index,
                                SessionImplementor session,
                                Object owner)
Specified by:
getElementByIndex in interface CollectionPersister
Overrides:
getElementByIndex in class AbstractCollectionPersister


Copyright © 2009 Hibernate.org. All Rights Reserved.