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

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


net.sf.hibernate.collection
Class ArrayHolder

java.lang.Object
  extended bynet.sf.hibernate.collection.PersistentCollection
      extended bynet.sf.hibernate.collection.ArrayHolder
All Implemented Interfaces:
Serializable

public class ArrayHolder
extends PersistentCollection

A persistent wrapper for an array. Lazy initialization is NOT supported. Use of Hibernate arrays is not really recommended.

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
ArrayHolder(SessionImplementor session, CollectionPersister persister)
           
ArrayHolder(SessionImplementor session, Object array)
           
 
Method Summary
 void beforeInitialize(CollectionPersister persister)
          Called before any elements are read into the collection, allowing appropriate initializations to occur.
 void beginRead()
          Called just before reading any rows from the JDBC result set
 Serializable disassemble(CollectionPersister persister)
          Disassemble the collection, ready for the cache
 Iterator elements()
           
 boolean empty()
          Is the initialized collection empty?
 boolean endRead()
          Called after reading all rows from the JDBC result set
 Iterator entries()
          Iterate all collection entries, during update of the database
 boolean entryExists(Object entry, int i)
          Does an element exist at this entry in the collection?
 boolean equalsSnapshot(Type elementType)
          Does the current state exactly match the snapshot?
 Object getArray()
           
 Iterator getDeletes(Type elemType)
          Get all the elements that need deleting
 Object getIndex(Object entry, int i)
          Get the index of the given collection entry
 Collection getOrphans(Serializable snapshot)
          get all "orphaned" elements
 Object getValue()
          return the user-visible collection (or array) instance
 void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
          Read the state of the collection from a disassembled cached value
 boolean isDirectlyAccessible()
          Could the application possibly have a direct reference to the underlying collection implementation?
 boolean isWrapper(Object collection)
          Is this the wrapper for the given underlying collection instance?
 boolean needsInserting(Object entry, int i, Type elemType)
          Do we need to insert this element?
 boolean needsUpdating(Object entry, int i, Type elemType)
          Do we need to update this element?
 Object readFrom(ResultSet rs, CollectionPersister persister, Object owner)
          Read a row from the JDBC result set
protected  Serializable snapshot(CollectionPersister persister)
          Return a new snapshot of the current state
 void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder)
          Write a row to the JDBC prepared statement
 
Methods inherited from class net.sf.hibernate.collection.PersistentCollection
afterRowInsert, delayedAddAll, forceInitialization, getCollectionSnapshot, getOrphans, getSession, getSnapshot, getSnapshot, hasQueuedAdditions, initialize, needsRecreate, postFlush, preInsert, queueAdd, queueAddAll, queuedAdditionIterator, read, setCollectionSnapshot, setCurrentSession, setDirectlyAccessible, setInitialized, unsetSession, wasInitialized, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayHolder

public ArrayHolder(SessionImplementor session,
                   Object array)

ArrayHolder

public ArrayHolder(SessionImplementor session,
                   CollectionPersister persister)
            throws HibernateException
Method Detail

snapshot

protected Serializable snapshot(CollectionPersister persister)
                         throws HibernateException
Description copied from class: PersistentCollection
Return a new snapshot of the current state

Specified by:
snapshot in class PersistentCollection
Throws:
HibernateException

getOrphans

public Collection getOrphans(Serializable snapshot)
                      throws HibernateException
Description copied from class: PersistentCollection
get all "orphaned" elements

Specified by:
getOrphans in class PersistentCollection
Throws:
HibernateException

getArray

public Object getArray()

isWrapper

public boolean isWrapper(Object collection)
Description copied from class: PersistentCollection
Is this the wrapper for the given underlying collection instance?

Specified by:
isWrapper in class PersistentCollection

equalsSnapshot

public boolean equalsSnapshot(Type elementType)
                       throws HibernateException
Description copied from class: PersistentCollection
Does the current state exactly match the snapshot?

Specified by:
equalsSnapshot in class PersistentCollection
Throws:
HibernateException

elements

public Iterator elements()
See Also:
PersistentCollection.entries()

empty

public boolean empty()
Description copied from class: PersistentCollection
Is the initialized collection empty?

Specified by:
empty in class PersistentCollection

writeTo

public void writeTo(PreparedStatement st,
                    CollectionPersister persister,
                    Object entry,
                    int i,
                    boolean writeOrder)
             throws HibernateException,
                    SQLException
Description copied from class: PersistentCollection
Write a row to the JDBC prepared statement

Specified by:
writeTo in class PersistentCollection
Throws:
HibernateException
SQLException
See Also:
PersistentCollection.writeTo(PreparedStatement, CollectionPersister, Object, int, boolean)

readFrom

public Object readFrom(ResultSet rs,
                       CollectionPersister persister,
                       Object owner)
                throws HibernateException,
                       SQLException
Description copied from class: PersistentCollection
Read a row from the JDBC result set

Specified by:
readFrom in class PersistentCollection
Throws:
HibernateException
SQLException
See Also:
PersistentCollection.readFrom(ResultSet, CollectionPersister, Object)

entries

public Iterator entries()
Description copied from class: PersistentCollection
Iterate all collection entries, during update of the database

Specified by:
entries in class PersistentCollection
See Also:
PersistentCollection.entries()

beginRead

public void beginRead()
Description copied from class: PersistentCollection
Called just before reading any rows from the JDBC result set

Overrides:
beginRead in class PersistentCollection

endRead

public boolean endRead()
Description copied from class: PersistentCollection
Called after reading all rows from the JDBC result set

Overrides:
endRead in class PersistentCollection

beforeInitialize

public void beforeInitialize(CollectionPersister persister)
Description copied from class: PersistentCollection
Called before any elements are read into the collection, allowing appropriate initializations to occur.

Specified by:
beforeInitialize in class PersistentCollection

isDirectlyAccessible

public boolean isDirectlyAccessible()
Description copied from class: PersistentCollection
Could the application possibly have a direct reference to the underlying collection implementation?

Overrides:
isDirectlyAccessible in class PersistentCollection

initializeFromCache

public void initializeFromCache(CollectionPersister persister,
                                Serializable disassembled,
                                Object owner)
                         throws HibernateException
Description copied from class: PersistentCollection
Read the state of the collection from a disassembled cached value

Specified by:
initializeFromCache in class PersistentCollection
Throws:
HibernateException

disassemble

public Serializable disassemble(CollectionPersister persister)
                         throws HibernateException
Description copied from class: PersistentCollection
Disassemble the collection, ready for the cache

Specified by:
disassemble in class PersistentCollection
Throws:
HibernateException

getValue

public Object getValue()
Description copied from class: PersistentCollection
return the user-visible collection (or array) instance

Overrides:
getValue in class PersistentCollection

getDeletes

public Iterator getDeletes(Type elemType)
                    throws HibernateException
Description copied from class: PersistentCollection
Get all the elements that need deleting

Specified by:
getDeletes in class PersistentCollection
Throws:
HibernateException

needsInserting

public boolean needsInserting(Object entry,
                              int i,
                              Type elemType)
                       throws HibernateException
Description copied from class: PersistentCollection
Do we need to insert this element?

Specified by:
needsInserting in class PersistentCollection
Throws:
HibernateException

needsUpdating

public boolean needsUpdating(Object entry,
                             int i,
                             Type elemType)
                      throws HibernateException
Description copied from class: PersistentCollection
Do we need to update this element?

Specified by:
needsUpdating in class PersistentCollection
Throws:
HibernateException

getIndex

public Object getIndex(Object entry,
                       int i)
Description copied from class: PersistentCollection
Get the index of the given collection entry

Specified by:
getIndex in class PersistentCollection
See Also:
PersistentCollection.getIndex(Object, int)

entryExists

public boolean entryExists(Object entry,
                           int i)
Description copied from class: PersistentCollection
Does an element exist at this entry in the collection?

Specified by:
entryExists in class PersistentCollection
See Also:
PersistentCollection.entryExists(java.lang.Object, int)