|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hibernate.persister.collection.AbstractCollectionPersister
Base implementation of the QueryableCollection interface.
BasicCollectionPersister
,
OneToManyPersister
Field Summary | |
protected int |
batchSize
|
protected String[] |
elementColumnAliases
|
protected boolean[] |
elementColumnIsInPrimaryKey
|
protected boolean[] |
elementColumnIsSettable
|
protected String[] |
elementColumnNames
|
protected String[] |
elementFormulas
|
protected String[] |
elementFormulaTemplates
|
protected boolean |
elementIsPureFormula
|
protected Type |
elementType
|
protected boolean |
hasIdentifier
|
protected boolean |
hasIndex
|
protected boolean |
hasWhere
|
protected String |
identifierColumnName
|
protected String[] |
indexColumnAliases
|
protected boolean[] |
indexColumnIsSettable
|
protected String[] |
indexColumnNames
|
protected boolean |
indexContainsFormula
|
protected String[] |
indexFormulas
|
protected String[] |
indexFormulaTemplates
|
protected String[] |
keyColumnAliases
|
protected String[] |
keyColumnNames
|
protected String |
qualifiedTableName
|
protected String |
sqlWhereString
|
Constructor Summary | |
AbstractCollectionPersister(Collection collection,
CacheConcurrencyStrategy cache,
Configuration cfg,
SessionFactoryImplementor factory)
|
Method Summary | |
protected void |
appendElementColumns(SelectFragment frag,
String elemAlias)
|
protected void |
appendIdentifierColumns(SelectFragment frag,
String alias)
|
protected void |
appendIndexColumns(SelectFragment frag,
String alias)
|
protected abstract CollectionInitializer |
createCollectionInitializer(Map enabledFilters)
|
protected abstract CollectionInitializer |
createSubselectInitializer(SubselectFetch subselect,
SessionImplementor session)
|
protected Object |
decrementIndexByBase(Object index)
|
void |
deleteRows(PersistentCollection collection,
Serializable id,
SessionImplementor session)
Delete the persistent state of any elements that were removed from the collection |
protected abstract int |
doUpdateRows(Serializable key,
PersistentCollection collection,
SessionImplementor session)
|
boolean |
elementExists(Serializable key,
Object element,
SessionImplementor session)
|
protected String |
filterFragment(String alias)
|
String |
filterFragment(String alias,
Map enabledFilters)
Get the where clause filter, given a query alias and considering enabled session filters |
protected abstract String |
generateDeleteRowString()
|
protected abstract String |
generateDeleteString()
|
protected String |
generateDetectRowByElementString()
|
protected String |
generateDetectRowByIndexString()
|
protected abstract String |
generateInsertRowString()
|
protected SelectFragment |
generateSelectFragment(String alias,
String columnSuffix)
|
protected String |
generateSelectRowByIndexString()
|
protected String |
generateSelectSizeString(boolean isIntegerIndexed)
|
protected abstract String |
generateUpdateRowString()
|
protected CollectionInitializer |
getAppropriateInitializer(Serializable key,
SessionImplementor session)
|
CacheConcurrencyStrategy |
getCache()
Get the cache |
CacheEntryStructure |
getCacheEntryStructure()
Get the cache structure |
CollectionMetadata |
getCollectionMetadata()
|
String[] |
getCollectionPropertyColumnAliases(String propertyName,
String suffix)
|
Serializable[] |
getCollectionSpaces()
Get the "space" that holds the persistent state |
CollectionType |
getCollectionType()
Get the associated Type |
protected ExecuteUpdateResultCheckStyle |
getDeleteAllCheckStyle()
|
protected ExecuteUpdateResultCheckStyle |
getDeleteCheckStyle()
|
protected Dialect |
getDialect()
|
Object |
getElementByIndex(Serializable key,
Object index,
SessionImplementor session,
Object owner)
|
Class |
getElementClass()
Return the element class of an array, or null otherwise |
String[] |
getElementColumnAliases(String suffix)
Generates the collection's element column aliases, based on the given suffix. |
String[] |
getElementColumnNames()
Get the names of the collection element columns (or the primary key columns in the case of a one-to-many association) |
String[] |
getElementColumnNames(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 alias |
String |
getElementNodeName()
|
EntityPersister |
getElementPersister()
Get the persister of the element class, if this is a collection of entities (optional operation). |
Type |
getElementType()
The collection element type |
SessionFactoryImplementor |
getFactory()
|
FetchMode |
getFetchMode()
Should we load this collection role by outerjoining? |
String |
getIdentifierColumnAlias(String suffix)
Generates the collection's identifier column aliases, based on the given suffix. |
String |
getIdentifierColumnName()
|
IdentifierGenerator |
getIdentifierGenerator()
Get the surrogate key generation strategy (optional operation) |
Type |
getIdentifierType()
Get the type of the surrogate key |
String[] |
getIndexColumnAliases(String suffix)
Generates the collection's index column aliases, based on the given suffix. |
String[] |
getIndexColumnNames()
Get the names of the collection index columns if this is an indexed collection (optional operation) |
String[] |
getIndexColumnNames(String alias)
Get the names of the collection index columns if this is an indexed collection (optional operation), aliased by the given table alias |
String[] |
getIndexFormulas()
Get the index formulas if this is an indexed collection (optional operation) |
String |
getIndexNodeName()
|
Type |
getIndexType()
The collection index type (or null if the collection has no index) |
protected ExecuteUpdateResultCheckStyle |
getInsertCheckStyle()
|
String[] |
getKeyColumnAliases(String suffix)
Generates the collection's key column aliases, based on the given suffix. |
String[] |
getKeyColumnNames()
The columns to join on |
Type |
getKeyType()
The collection key type |
String |
getManyToManyFilterFragment(String alias,
Map enabledFilters)
|
String |
getManyToManyOrderByString(String alias)
Get the order-by to be applied at the target table of a many to many |
String |
getName()
An identifying name; a class name or collection role name. |
String |
getNodeName()
|
String |
getOwnerEntityName()
|
EntityPersister |
getOwnerEntityPersister()
Get the persister of the entity that "owns" this collection |
String |
getRole()
The name of this collection role |
int |
getSize(Serializable key,
SessionImplementor session)
|
protected String |
getSQLDeleteRowString()
|
protected String |
getSQLDeleteString()
|
protected SQLExceptionConverter |
getSQLExceptionConverter()
|
protected String |
getSQLInsertRowString()
|
String |
getSQLOrderByString(String alias)
Get the order by SQL |
protected String |
getSQLUpdateRowString()
|
protected String |
getSQLWhereString(String alias)
|
String |
getTableName()
The table to join to. |
Type |
getType()
Get the type of the thing containing the properties |
protected ExecuteUpdateResultCheckStyle |
getUpdateCheckStyle()
|
boolean |
hasCache()
Is this collection role cacheable |
boolean |
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 Object |
incrementIndexByBase(Object index)
|
boolean |
indexExists(Serializable key,
Object index,
SessionImplementor session)
|
void |
initCollectionPropertyMap()
|
void |
initialize(Serializable key,
SessionImplementor session)
Initialize the given collection with the given key |
void |
insertRows(PersistentCollection collection,
Serializable id,
SessionImplementor session)
Insert the persistent state of any new collection elements |
boolean |
isAffectedByEnabledFilters(SessionImplementor 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()
|
String |
oneToManyFilterFragment(String alias)
|
void |
postInstantiate()
|
Object |
readElement(ResultSet rs,
Object owner,
String[] aliases,
SessionImplementor session)
Read the element from a row of the JDBC ResultSet |
Object |
readIdentifier(ResultSet rs,
String alias,
SessionImplementor session)
Read the identifier from a row of the JDBC ResultSet |
Object |
readIndex(ResultSet rs,
String[] aliases,
SessionImplementor session)
Read the index from a row of the JDBC ResultSet |
Object |
readKey(ResultSet rs,
String[] aliases,
SessionImplementor session)
Read the key from a row of the JDBC ResultSet |
void |
recreate(PersistentCollection collection,
Serializable id,
SessionImplementor session)
(Re)create the collection's persistent state |
void |
remove(Serializable id,
SessionImplementor session)
Completely remove the persistent state of the collection |
String |
selectFragment(String alias,
String columnSuffix)
Generate a list of collection index, key and element columns |
String[] |
toColumns(String propertyName)
Given a property path, return the corresponding column name(s). |
String[] |
toColumns(String alias,
String propertyName)
Given a query alias and a property path, return the qualified column name |
String |
toString()
|
Type |
toType(String propertyName)
Given a component path expression, get the type of the property |
void |
updateRows(PersistentCollection collection,
Serializable id,
SessionImplementor session)
Update the persistent state of any elements that were modified |
protected int |
writeElement(PreparedStatement st,
Object elt,
int i,
SessionImplementor session)
Write the element to a JDBC PreparedStatement |
protected int |
writeElementToWhere(PreparedStatement st,
Object elt,
int i,
SessionImplementor session)
Write the element to a JDBC PreparedStatement |
int |
writeIdentifier(PreparedStatement st,
Object id,
int i,
SessionImplementor session)
Write the identifier to a JDBC PreparedStatement |
protected int |
writeIndex(PreparedStatement st,
Object index,
int i,
SessionImplementor session)
Write the index to a JDBC PreparedStatement |
protected int |
writeIndexToWhere(PreparedStatement st,
Object index,
int i,
SessionImplementor session)
Write the index to a JDBC PreparedStatement |
protected int |
writeKey(PreparedStatement st,
Serializable key,
int i,
SessionImplementor 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.entity.Joinable |
consumesCollectionAlias, consumesEntityAlias, fromJoinFragment, selectFragment, whereJoinFragment |
Methods inherited from interface org.hibernate.persister.collection.CollectionPersister |
isCascadeDeleteEnabled, isOneToMany |
Field Detail |
protected final String sqlWhereString
protected final boolean hasWhere
protected final boolean indexContainsFormula
protected final boolean elementIsPureFormula
protected final Type elementType
protected final String[] keyColumnNames
protected final String[] indexColumnNames
protected final String[] indexFormulaTemplates
protected final String[] indexFormulas
protected final boolean[] indexColumnIsSettable
protected final String[] elementColumnNames
protected final String[] elementFormulaTemplates
protected final String[] elementFormulas
protected final boolean[] elementColumnIsSettable
protected final boolean[] elementColumnIsInPrimaryKey
protected final String[] indexColumnAliases
protected final String[] elementColumnAliases
protected final String[] keyColumnAliases
protected final String identifierColumnName
protected final String qualifiedTableName
protected final boolean hasIndex
protected final boolean hasIdentifier
protected final int batchSize
Constructor Detail |
public AbstractCollectionPersister(Collection collection, CacheConcurrencyStrategy cache, Configuration cfg, SessionFactoryImplementor factory) throws MappingException, CacheException
Method Detail |
public void postInstantiate() throws MappingException
postInstantiate
in interface CollectionPersister
MappingException
protected void logStaticSQL()
public void initialize(Serializable key, SessionImplementor session) throws HibernateException
CollectionPersister
initialize
in interface CollectionPersister
HibernateException
protected CollectionInitializer getAppropriateInitializer(Serializable key, SessionImplementor session)
protected abstract CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session)
protected abstract CollectionInitializer createCollectionInitializer(Map enabledFilters) throws MappingException
MappingException
public CacheConcurrencyStrategy getCache()
CollectionPersister
getCache
in interface CollectionPersister
public boolean hasCache()
CollectionPersister
hasCache
in interface CollectionPersister
public CollectionType getCollectionType()
CollectionPersister
getCollectionType
in interface CollectionPersister
protected String getSQLWhereString(String alias)
public String getSQLOrderByString(String alias)
QueryableCollection
getSQLOrderByString
in interface QueryableCollection
public String getManyToManyOrderByString(String alias)
QueryableCollection
getManyToManyOrderByString
in interface QueryableCollection
alias
- The alias for the many-to-many target table
public FetchMode getFetchMode()
QueryableCollection
getFetchMode
in interface QueryableCollection
public boolean hasOrdering()
CollectionPersister
hasOrdering
in interface CollectionPersister
public boolean hasManyToManyOrdering()
hasManyToManyOrdering
in interface CollectionPersister
public boolean hasWhere()
QueryableCollection
hasWhere
in interface QueryableCollection
protected String getSQLDeleteString()
protected String getSQLInsertRowString()
protected String getSQLUpdateRowString()
protected String getSQLDeleteRowString()
public Type getKeyType()
CollectionMetadata
getKeyType
in interface CollectionMetadata
public Type getIndexType()
CollectionMetadata
getIndexType
in interface CollectionMetadata
public Type getElementType()
CollectionMetadata
getElementType
in interface CollectionMetadata
public Class getElementClass()
getElementClass
in interface CollectionPersister
public Object readElement(ResultSet rs, Object owner, String[] aliases, SessionImplementor session) throws HibernateException, SQLException
CollectionPersister
readElement
in interface CollectionPersister
HibernateException
SQLException
public Object readIndex(ResultSet rs, String[] aliases, SessionImplementor session) throws HibernateException, SQLException
CollectionPersister
readIndex
in interface CollectionPersister
HibernateException
SQLException
protected Object decrementIndexByBase(Object index)
public Object readIdentifier(ResultSet rs, String alias, SessionImplementor session) throws HibernateException, SQLException
CollectionPersister
readIdentifier
in interface CollectionPersister
HibernateException
SQLException
public Object readKey(ResultSet rs, String[] aliases, SessionImplementor session) throws HibernateException, SQLException
CollectionPersister
readKey
in interface CollectionPersister
HibernateException
SQLException
protected int writeKey(PreparedStatement st, Serializable key, int i, SessionImplementor session) throws HibernateException, SQLException
HibernateException
SQLException
protected int writeElement(PreparedStatement st, Object elt, int i, SessionImplementor session) throws HibernateException, SQLException
HibernateException
SQLException
protected int writeIndex(PreparedStatement st, Object index, int i, SessionImplementor session) throws HibernateException, SQLException
HibernateException
SQLException
protected Object incrementIndexByBase(Object index)
protected int writeElementToWhere(PreparedStatement st, Object elt, int i, SessionImplementor session) throws HibernateException, SQLException
HibernateException
SQLException
protected int writeIndexToWhere(PreparedStatement st, Object index, int i, SessionImplementor session) throws HibernateException, SQLException
HibernateException
SQLException
public int writeIdentifier(PreparedStatement st, Object id, int i, SessionImplementor session) throws HibernateException, SQLException
HibernateException
SQLException
public boolean isPrimitiveArray()
CollectionMetadata
isPrimitiveArray
in interface CollectionMetadata
public boolean isArray()
CollectionMetadata
isArray
in interface CollectionMetadata
public String[] getKeyColumnAliases(String suffix)
CollectionPersister
getKeyColumnAliases
in interface CollectionPersister
suffix
- The suffix to use in the key column alias generation.
public String[] getElementColumnAliases(String suffix)
CollectionPersister
getElementColumnAliases
in interface CollectionPersister
suffix
- The suffix to use in the element column alias generation.
public String[] getIndexColumnAliases(String suffix)
CollectionPersister
getIndexColumnAliases
in interface CollectionPersister
suffix
- The suffix to use in the index column alias generation.
public String getIdentifierColumnAlias(String suffix)
CollectionPersister
getIdentifierColumnAlias
in interface CollectionPersister
suffix
- The suffix to use in the key column alias generation.
public String getIdentifierColumnName()
getIdentifierColumnName
in interface SQLLoadableCollection
public String selectFragment(String alias, String columnSuffix)
selectFragment
in interface QueryableCollection
protected String generateSelectSizeString(boolean isIntegerIndexed)
protected String generateDetectRowByIndexString()
protected String generateSelectRowByIndexString()
protected String generateDetectRowByElementString()
protected SelectFragment generateSelectFragment(String alias, String columnSuffix)
protected void appendElementColumns(SelectFragment frag, String elemAlias)
protected void appendIndexColumns(SelectFragment frag, String alias)
protected void appendIdentifierColumns(SelectFragment frag, String alias)
public String[] getIndexColumnNames()
QueryableCollection
getIndexColumnNames
in interface QueryableCollection
public String[] getIndexFormulas()
QueryableCollection
getIndexFormulas
in interface QueryableCollection
public String[] getIndexColumnNames(String alias)
QueryableCollection
getIndexColumnNames
in interface QueryableCollection
public String[] getElementColumnNames(String alias)
QueryableCollection
getElementColumnNames
in interface QueryableCollection
public String[] getElementColumnNames()
QueryableCollection
getElementColumnNames
in interface QueryableCollection
public String[] getKeyColumnNames()
Joinable
getKeyColumnNames
in interface Joinable
public boolean hasIndex()
CollectionMetadata
hasIndex
in interface CollectionMetadata
public boolean isLazy()
CollectionMetadata
isLazy
in interface CollectionMetadata
public boolean isInverse()
CollectionPersister
isInverse
in interface CollectionPersister
public String getTableName()
Joinable
getTableName
in interface Joinable
public void remove(Serializable id, SessionImplementor session) throws HibernateException
CollectionPersister
remove
in interface CollectionPersister
HibernateException
public void recreate(PersistentCollection collection, Serializable id, SessionImplementor session) throws HibernateException
CollectionPersister
recreate
in interface CollectionPersister
HibernateException
protected boolean isRowDeleteEnabled()
public void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws HibernateException
CollectionPersister
deleteRows
in interface CollectionPersister
HibernateException
protected boolean isRowInsertEnabled()
public void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws HibernateException
CollectionPersister
insertRows
in interface CollectionPersister
HibernateException
public String getRole()
CollectionMetadata
getRole
in interface CollectionMetadata
public String getOwnerEntityName()
public EntityPersister getOwnerEntityPersister()
CollectionPersister
getOwnerEntityPersister
in interface CollectionPersister
public IdentifierGenerator getIdentifierGenerator()
CollectionPersister
getIdentifierGenerator
in interface CollectionPersister
public Type getIdentifierType()
CollectionPersister
getIdentifierType
in interface CollectionPersister
public boolean hasOrphanDelete()
CollectionPersister
hasOrphanDelete
in interface CollectionPersister
public Type toType(String propertyName) throws QueryException
PropertyMapping
toType
in interface PropertyMapping
QueryException
public abstract boolean isManyToMany()
CollectionPersister
isManyToMany
in interface CollectionPersister
public String getManyToManyFilterFragment(String alias, Map enabledFilters)
getManyToManyFilterFragment
in interface CollectionPersister
public String[] toColumns(String alias, String propertyName) throws QueryException
PropertyMapping
toColumns
in interface PropertyMapping
QueryException
public String[] toColumns(String propertyName) throws QueryException
PropertyMapping
toColumns
in interface PropertyMapping
QueryException
public Type getType()
PropertyMapping
getType
in interface PropertyMapping
public String getName()
Joinable
getName
in interface Joinable
public EntityPersister getElementPersister()
QueryableCollection
getElementPersister
in interface QueryableCollection
public boolean isCollection()
Joinable
isCollection
in interface Joinable
public Serializable[] getCollectionSpaces()
CollectionPersister
getCollectionSpaces
in interface CollectionPersister
protected abstract String generateDeleteString()
protected abstract String generateDeleteRowString()
protected abstract String generateUpdateRowString()
protected abstract String generateInsertRowString()
public void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws HibernateException
CollectionPersister
updateRows
in interface CollectionPersister
HibernateException
protected abstract int doUpdateRows(Serializable key, PersistentCollection collection, SessionImplementor session) throws HibernateException
HibernateException
public CollectionMetadata getCollectionMetadata()
getCollectionMetadata
in interface CollectionPersister
public SessionFactoryImplementor getFactory()
getFactory
in interface CollectionPersister
protected String filterFragment(String alias) throws MappingException
MappingException
public String filterFragment(String alias, Map enabledFilters) throws MappingException
Joinable
filterFragment
in interface Joinable
MappingException
public String oneToManyFilterFragment(String alias) throws MappingException
oneToManyFilterFragment
in interface Joinable
MappingException
protected boolean isInsertCallable()
protected ExecuteUpdateResultCheckStyle getInsertCheckStyle()
protected boolean isUpdateCallable()
protected ExecuteUpdateResultCheckStyle getUpdateCheckStyle()
protected boolean isDeleteCallable()
protected ExecuteUpdateResultCheckStyle getDeleteCheckStyle()
protected boolean isDeleteAllCallable()
protected ExecuteUpdateResultCheckStyle getDeleteAllCheckStyle()
public String toString()
public boolean isVersioned()
CollectionPersister
isVersioned
in interface CollectionPersister
public String getNodeName()
getNodeName
in interface CollectionPersister
public String getElementNodeName()
getElementNodeName
in interface CollectionPersister
public String getIndexNodeName()
getIndexNodeName
in interface CollectionPersister
protected SQLExceptionConverter getSQLExceptionConverter()
public CacheEntryStructure getCacheEntryStructure()
CollectionPersister
getCacheEntryStructure
in interface CollectionPersister
public boolean isAffectedByEnabledFilters(SessionImplementor session)
isAffectedByEnabledFilters
in interface CollectionPersister
public boolean isSubselectLoadable()
public boolean isMutable()
CollectionPersister
isMutable
in interface CollectionPersister
public String[] getCollectionPropertyColumnAliases(String propertyName, String suffix)
getCollectionPropertyColumnAliases
in interface SQLLoadableCollection
public void initCollectionPropertyMap()
public int getSize(Serializable key, SessionImplementor session)
getSize
in interface CollectionPersister
public boolean indexExists(Serializable key, Object index, SessionImplementor session)
indexExists
in interface CollectionPersister
public boolean elementExists(Serializable key, Object element, SessionImplementor session)
elementExists
in interface CollectionPersister
public Object getElementByIndex(Serializable key, Object index, SessionImplementor session, Object owner)
getElementByIndex
in interface CollectionPersister
public boolean isExtraLazy()
isExtraLazy
in interface CollectionPersister
protected Dialect getDialect()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |