站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

CollectionPersister (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.collection
Interface CollectionPersister

All Known Subinterfaces:
QueryableCollection
All Known Implementing Classes:
AbstractCollectionPersister

public interface CollectionPersister

A strategy for persisting a collection role. Defines a contract between the persistence strategy and the actual persistent collection framework and session. Does not define operations that are required for querying collections, or loading by outer join.

Implements persistence of a collection instance while the instance is referenced in a particular role.

This class is highly coupled to the PersistentCollection hierarchy, since double dispatch is used to load and update collection elements.

May be considered an immutable view of the mapping object

Author:
Gavin King
See Also:
QueryableCollection, PersistentCollection

Method Summary
 void deleteRows(PersistentCollection collection, Serializable key, SessionImplementor session)
          Delete the persistent state of any elements that were removed from the collection
 CacheConcurrencyStrategy getCache()
          Get the cache
 CollectionMetadata getCollectionMetadata()
           
 Serializable getCollectionSpace()
          Get the "space" that holds the persistent state
 PersistentCollectionType getCollectionType()
          Get the associated Type
 Class getElementClass()
          Return the element class of an array, or null otherwise
 Type getElementType()
          Get the "element" type
 IdentifierGenerator getIdentifierGenerator()
          Get the surrogate key generation strategy (optional operation)
 Type getIdentifierType()
          Get the type of the surrogate key
 Type getIndexType()
          Get the "index" type for a list or map (optional operation)
 Type getKeyType()
          Get the "key" type (the type of the foreign key)
 Class getOwnerClass()
          Get the entity class that "owns" this collection
 String getRole()
          Get the name of this collection role (the fully qualified class name, extended by a "property path")
 boolean hasCache()
          Is this collection role cacheable
 boolean hasIndex()
          Is this an "indexed" collection? (list or map)
 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"?
 void initialize(Serializable key, SessionImplementor session)
          Initialize the given collection with the given key
 void insertRows(PersistentCollection collection, Serializable key, SessionImplementor session)
          Insert the persistent state of any new collection elements
 boolean isArray()
          Is this an array?
 boolean isInverse()
          Is this collection "inverse", so state changes are not propogated to the database.
 boolean isLazy()
          Is this collection lazyily initialized?
 boolean isOneToMany()
          Is this a one-to-many association?
 boolean isPrimitiveArray()
          Is this an array or primitive values?
 Object readElement(ResultSet rs, Object owner, SessionImplementor session)
          Read the element from a row of the JDBC ResultSet
 Object readIdentifier(ResultSet rs, SessionImplementor session)
          Read the identifier from a row of the JDBC ResultSet
 Object readIndex(ResultSet rs, SessionImplementor session)
          Read the index from a row of the JDBC ResultSet
 Object readKey(ResultSet rs, SessionImplementor session)
          Read the key from a row of the JDBC ResultSet
 void recreate(PersistentCollection collection, Serializable key, SessionImplementor session)
          (Re)create the collection's persistent state
 void remove(Serializable id, SessionImplementor session)
          Completely remove the persistent state of the collection
 void updateRows(PersistentCollection collection, Serializable key, SessionImplementor session)
          Update the persistent state of any elements that were modified
 void writeElement(PreparedStatement st, Object elt, boolean writeOrder, SessionImplementor session)
          Write the element to a JDBC PreparedStatement
 void writeIdentifier(PreparedStatement st, Object idx, boolean writeOrder, SessionImplementor session)
          Write the identifier to a JDBC PreparedStatement
 void writeIndex(PreparedStatement st, Object idx, boolean writeOrder, SessionImplementor session)
          Write the index to a JDBC PreparedStatement
 void writeKey(PreparedStatement st, Serializable key, boolean writeOrder, SessionImplementor session)
          Write the key to a JDBC PreparedStatement
 

Method Detail

initialize

public void initialize(Serializable key,
                       SessionImplementor session)
                throws HibernateException
Initialize the given collection with the given key

Throws:
HibernateException

getCache

public CacheConcurrencyStrategy getCache()
Get the cache


hasCache

public boolean hasCache()
Is this collection role cacheable


getCollectionType

public PersistentCollectionType getCollectionType()
Get the associated Type


getKeyType

public Type getKeyType()
Get the "key" type (the type of the foreign key)


getIndexType

public Type getIndexType()
Get the "index" type for a list or map (optional operation)


getElementType

public Type getElementType()
Get the "element" type


getElementClass

public Class getElementClass()
Return the element class of an array, or null otherwise


readKey

public Object readKey(ResultSet rs,
                      SessionImplementor session)
               throws HibernateException,
                      SQLException
Read the key from a row of the JDBC ResultSet

Throws:
HibernateException
SQLException

readElement

public Object readElement(ResultSet rs,
                          Object owner,
                          SessionImplementor session)
                   throws HibernateException,
                          SQLException
Read the element from a row of the JDBC ResultSet

Throws:
HibernateException
SQLException

readIndex

public Object readIndex(ResultSet rs,
                        SessionImplementor session)
                 throws HibernateException,
                        SQLException
Read the index from a row of the JDBC ResultSet

Throws:
HibernateException
SQLException

readIdentifier

public Object readIdentifier(ResultSet rs,
                             SessionImplementor session)
                      throws HibernateException,
                             SQLException
Read the identifier from a row of the JDBC ResultSet

Throws:
HibernateException
SQLException

writeKey

public void writeKey(PreparedStatement st,
                     Serializable key,
                     boolean writeOrder,
                     SessionImplementor session)
              throws HibernateException,
                     SQLException
Write the key to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

writeElement

public void writeElement(PreparedStatement st,
                         Object elt,
                         boolean writeOrder,
                         SessionImplementor session)
                  throws HibernateException,
                         SQLException
Write the element to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

writeIndex

public void writeIndex(PreparedStatement st,
                       Object idx,
                       boolean writeOrder,
                       SessionImplementor session)
                throws HibernateException,
                       SQLException
Write the index to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

writeIdentifier

public void writeIdentifier(PreparedStatement st,
                            Object idx,
                            boolean writeOrder,
                            SessionImplementor session)
                     throws HibernateException,
                            SQLException
Write the identifier to a JDBC PreparedStatement

Throws:
HibernateException
SQLException

isPrimitiveArray

public boolean isPrimitiveArray()
Is this an array or primitive values?


isArray

public boolean isArray()
Is this an array?


isOneToMany

public boolean isOneToMany()
Is this a one-to-many association?


hasIndex

public boolean hasIndex()
Is this an "indexed" collection? (list or map)


isLazy

public boolean isLazy()
Is this collection lazyily initialized?


isInverse

public boolean isInverse()
Is this collection "inverse", so state changes are not propogated to the database.


remove

public void remove(Serializable id,
                   SessionImplementor session)
            throws HibernateException
Completely remove the persistent state of the collection

Throws:
HibernateException

recreate

public void recreate(PersistentCollection collection,
                     Serializable key,
                     SessionImplementor session)
              throws HibernateException
(Re)create the collection's persistent state

Throws:
HibernateException

deleteRows

public void deleteRows(PersistentCollection collection,
                       Serializable key,
                       SessionImplementor session)
                throws HibernateException
Delete the persistent state of any elements that were removed from the collection

Throws:
HibernateException

updateRows

public void updateRows(PersistentCollection collection,
                       Serializable key,
                       SessionImplementor session)
                throws HibernateException
Update the persistent state of any elements that were modified

Throws:
HibernateException

insertRows

public void insertRows(PersistentCollection collection,
                       Serializable key,
                       SessionImplementor session)
                throws HibernateException
Insert the persistent state of any new collection elements

Throws:
HibernateException

getRole

public String getRole()
Get the name of this collection role (the fully qualified class name, extended by a "property path")


getOwnerClass

public Class getOwnerClass()
Get the entity class that "owns" this collection


getIdentifierGenerator

public IdentifierGenerator getIdentifierGenerator()
Get the surrogate key generation strategy (optional operation)


getIdentifierType

public Type getIdentifierType()
Get the type of the surrogate key


hasOrphanDelete

public boolean hasOrphanDelete()
Does this collection implement "orphan delete"?


hasOrdering

public 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.)


getCollectionSpace

public Serializable getCollectionSpace()
Get the "space" that holds the persistent state


getCollectionMetadata

public CollectionMetadata getCollectionMetadata()