org.hibernate.collection
Class PersistentArrayHolder

java.lang.Object
  extended by org.hibernate.collection.AbstractPersistentCollection
      extended by org.hibernate.collection.PersistentArrayHolder
All Implemented Interfaces:
Serializable, PersistentCollection

public class PersistentArrayHolder
extends AbstractPersistentCollection

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.hibernate.collection.AbstractPersistentCollection
AbstractPersistentCollection.DelayedOperation
 
Field Summary
protected  Object array
           
 
Fields inherited from class org.hibernate.collection.AbstractPersistentCollection
UNKNOWN
 
Constructor Summary
PersistentArrayHolder(SessionImplementor session, CollectionPersister persister)
           
PersistentArrayHolder(SessionImplementor session, Object array)
           
 
Method Summary
 void beforeInitialize(CollectionPersister persister, int anticipatedSize)
          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(CollectionPersister persister)
          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(CollectionPersister persister)
          Does the current state exactly match the snapshot?
 Object getArray()
           
 Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula)
          Get all the elements that need deleting
 Object getElement(Object entry)
          Get the value of the given collection entry
 Object getIndex(Object entry, int i, CollectionPersister persister)
          Get the index of the given collection entry
 Collection getOrphans(Serializable snapshot, String entityName)
          get all "orphaned" elements
 Serializable getSnapshot(CollectionPersister persister)
          Return a new snapshot of the current state of the collection
 Object getSnapshotElement(Object entry, int i)
          Get the snapshot value of the given collection entry
 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 isSnapshotEmpty(Serializable snapshot)
          Is the snapshot empty?
 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, CollectionAliases descriptor, Object owner)
          Read a row from the JDBC result set
 
Methods inherited from class org.hibernate.collection.AbstractPersistentCollection
afterInitialize, afterRowInsert, clearDirty, dirty, forceInitialization, getCachedSize, getIdentifier, getKey, getOrphans, getOwner, getQueuedOrphans, getRole, getSession, getSnapshot, getStoredSnapshot, hasQueuedOperations, initialize, isClearQueueEnabled, isDirty, isOperationQueueEnabled, isPutQueueEnabled, isRowUpdatePossible, isUnreferenced, needsRecreate, performQueuedOperations, postAction, preInsert, queuedAdditionIterator, queueOperation, read, readElementByIndex, readElementExistence, readIndexExistence, readSize, setCurrentSession, setDirectlyAccessible, setInitialized, setOwner, setSnapshot, unsetSession, wasInitialized, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

array

protected Object array
Constructor Detail

PersistentArrayHolder

public PersistentArrayHolder(SessionImplementor session,
                             Object array)

PersistentArrayHolder

public PersistentArrayHolder(SessionImplementor session,
                             CollectionPersister persister)
                      throws HibernateException
Throws:
HibernateException
Method Detail

getSnapshot

public Serializable getSnapshot(CollectionPersister persister)
                         throws HibernateException
Description copied from interface: PersistentCollection
Return a new snapshot of the current state of the collection

Throws:
HibernateException

isSnapshotEmpty

public boolean isSnapshotEmpty(Serializable snapshot)
Description copied from interface: PersistentCollection
Is the snapshot empty?


getOrphans

public Collection getOrphans(Serializable snapshot,
                             String entityName)
                      throws HibernateException
Description copied from class: AbstractPersistentCollection
get all "orphaned" elements

Specified by:
getOrphans in interface PersistentCollection
Specified by:
getOrphans in class AbstractPersistentCollection
Throws:
HibernateException

getArray

public Object getArray()

isWrapper

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


equalsSnapshot

public boolean equalsSnapshot(CollectionPersister persister)
                       throws HibernateException
Description copied from interface: PersistentCollection
Does the current state exactly match the snapshot?

Throws:
HibernateException

elements

public Iterator elements()

empty

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

Specified by:
empty in interface PersistentCollection
Specified by:
empty in class AbstractPersistentCollection

readFrom

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

Throws:
HibernateException
SQLException

entries

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


beginRead

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

Specified by:
beginRead in interface PersistentCollection
Overrides:
beginRead in class AbstractPersistentCollection

endRead

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

Specified by:
endRead in interface PersistentCollection
Overrides:
endRead in class AbstractPersistentCollection

beforeInitialize

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

Parameters:
persister - The underlying collection persister.
anticipatedSize - The anticipated size of the collection after initilization is complete.

isDirectlyAccessible

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

Specified by:
isDirectlyAccessible in interface PersistentCollection
Overrides:
isDirectlyAccessible in class AbstractPersistentCollection

initializeFromCache

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

Throws:
HibernateException

disassemble

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

Throws:
HibernateException

getValue

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

Specified by:
getValue in interface PersistentCollection
Overrides:
getValue in class AbstractPersistentCollection

getDeletes

public Iterator getDeletes(CollectionPersister persister,
                           boolean indexIsFormula)
                    throws HibernateException
Description copied from interface: PersistentCollection
Get all the elements that need deleting

Throws:
HibernateException

needsInserting

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

Throws:
HibernateException

needsUpdating

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

Throws:
HibernateException

getIndex

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

persister - it was more elegant before we added this...

getElement

public Object getElement(Object entry)
Description copied from interface: PersistentCollection
Get the value of the given collection entry


getSnapshotElement

public Object getSnapshotElement(Object entry,
                                 int i)
Description copied from interface: PersistentCollection
Get the snapshot value of the given collection entry


entryExists

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



Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.