org.hibernate.collection

Class PersistentSet

Implemented Interfaces:
Serializable, Set, PersistentCollection
Known Direct Subclasses:
PersistentSortedSet

public class PersistentSet
extends AbstractPersistentCollection
implements Set

A persistent wrapper for a java.util.Set. The underlying collection is a HashSet.
Author:
Gavin King
See Also:
java.util.HashSet

Nested Class Summary

Nested classes/interfaces inherited from class org.hibernate.collection.AbstractPersistentCollection

AbstractPersistentCollection.DelayedOperation

Field Summary

protected Set
set
protected List
tempList

Fields inherited from class org.hibernate.collection.AbstractPersistentCollection

UNKNOWN

Constructor Summary

PersistentSet()
Empty constructor.
PersistentSet(SessionImplementor session)
Constructor matching super.
PersistentSet(SessionImplementor session, Set set)
Instantiates a non-lazy set (the underlying set is constructed from the incoming set reference).

Method Summary

boolean
add(Object value)
boolean
addAll(Collection coll)
void
beforeInitialize(CollectionPersister persister, int anticipatedSize)
void
beginRead()
void
clear()
boolean
contains(Object object)
boolean
containsAll(Collection coll)
Serializable
disassemble(CollectionPersister persister)
boolean
empty()
boolean
endRead()
Iterator
entries(CollectionPersister persister)
boolean
entryExists(Object key, int i)
boolean
equals(Object other)
boolean
equalsSnapshot(CollectionPersister persister)
Iterator
getDeletes(CollectionPersister persister, boolean indexIsFormula)
Object
getElement(Object entry)
Object
getIndex(Object entry, int i, CollectionPersister persister)
Collection
getOrphans(Serializable snapshot, String entityName)
Serializable
getSnapshot(CollectionPersister persister)
Object
getSnapshotElement(Object entry, int i)
int
hashCode()
void
initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
boolean
isEmpty()
boolean
isRowUpdatePossible()
boolean
isSnapshotEmpty(Serializable snapshot)
boolean
isWrapper(Object collection)
Iterator
iterator()
boolean
needsInserting(Object entry, int i, Type elemType)
boolean
needsUpdating(Object entry, int i, Type elemType)
Object
readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
boolean
remove(Object value)
boolean
removeAll(Collection coll)
boolean
retainAll(Collection coll)
int
size()
Object[]
toArray()
Object[]
toArray(Object[] array)
String
toString()

Methods inherited from class org.hibernate.collection.AbstractPersistentCollection

afterInitialize, afterRowInsert, beginRead, clearDirty, dirty, empty, endRead, forceInitialization, getCachedSize, getIdentifier, getKey, getOrphans, getOrphans, getOwner, getQueuedOrphans, getRole, getSession, getSnapshot, getStoredSnapshot, getValue, hasQueuedOperations, initialize, isClearQueueEnabled, isDirectlyAccessible, isDirty, isOperationQueueEnabled, isPutQueueEnabled, isRowUpdatePossible, isUnreferenced, needsRecreate, performQueuedOperations, postAction, preInsert, queueOperation, queuedAdditionIterator, read, readElementByIndex, readElementExistence, readIndexExistence, readSize, setCurrentSession, setDirectlyAccessible, setInitialized, setOwner, setSnapshot, unsetSession, wasInitialized, write

Field Details

set

protected Set set

tempList

protected List tempList

Constructor Details

PersistentSet

public PersistentSet()
Empty constructor.

Note: this form is not ever ever ever used by Hibernate; it is, however, needed for SOAP libraries and other such marshalling code.


PersistentSet

public PersistentSet(SessionImplementor session)
Constructor matching super. Instantiates a lazy set (the underlying set is un-initialized).
Parameters:
session - The session to which this set will belong.

PersistentSet

public PersistentSet(SessionImplementor session,
                     Set set)
Instantiates a non-lazy set (the underlying set is constructed from the incoming set reference).
Parameters:
session - The session to which this set will belong.
set - The underlying set data.

Method Details

add

public boolean add(Object value)
See Also:
java.util.Set.add(Object)

addAll

public boolean addAll(Collection coll)
See Also:
java.util.Set.addAll(Collection)

beforeInitialize

public void beforeInitialize(CollectionPersister persister,
                             int anticipatedSize)
Specified by:
beforeInitialize in interface PersistentCollection

beginRead

public void beginRead()
Specified by:
beginRead in interface PersistentCollection
Overrides:
beginRead in interface AbstractPersistentCollection

clear

public void clear()
See Also:
java.util.Set.clear()

contains

public boolean contains(Object object)
See Also:
java.util.Set.contains(Object)

containsAll

public boolean containsAll(Collection coll)
See Also:
java.util.Set.containsAll(Collection)

disassemble

public Serializable disassemble(CollectionPersister persister)
            throws HibernateException
Specified by:
disassemble in interface PersistentCollection

empty

public boolean empty()
Specified by:
empty in interface PersistentCollection
Overrides:
empty in interface AbstractPersistentCollection

endRead

public boolean endRead()
Specified by:
endRead in interface PersistentCollection
Overrides:
endRead in interface AbstractPersistentCollection

entries

public Iterator entries(CollectionPersister persister)
Specified by:
entries in interface PersistentCollection

entryExists

public boolean entryExists(Object key,
                           int i)
Specified by:
entryExists in interface PersistentCollection

equals

public boolean equals(Object other)

equalsSnapshot

public boolean equalsSnapshot(CollectionPersister persister)
            throws HibernateException
Specified by:
equalsSnapshot in interface PersistentCollection

getDeletes

public Iterator getDeletes(CollectionPersister persister,
                           boolean indexIsFormula)
            throws HibernateException
Specified by:
getDeletes in interface PersistentCollection

getElement

public Object getElement(Object entry)
Specified by:
getElement in interface PersistentCollection

getIndex

public Object getIndex(Object entry,
                       int i,
                       CollectionPersister persister)
Specified by:
getIndex in interface PersistentCollection

getOrphans

public Collection getOrphans(Serializable snapshot,
                             String entityName)
            throws HibernateException
Specified by:
getOrphans in interface PersistentCollection
Overrides:
getOrphans in interface AbstractPersistentCollection

getSnapshot

public Serializable getSnapshot(CollectionPersister persister)
            throws HibernateException
Specified by:
getSnapshot in interface PersistentCollection

getSnapshotElement

public Object getSnapshotElement(Object entry,
                                 int i)
Specified by:
getSnapshotElement in interface PersistentCollection

hashCode

public int hashCode()

initializeFromCache

public void initializeFromCache(CollectionPersister persister,
                                Serializable disassembled,
                                Object owner)
            throws HibernateException
Specified by:
initializeFromCache in interface PersistentCollection

isEmpty

public boolean isEmpty()
See Also:
java.util.Set.isEmpty()

isRowUpdatePossible

public boolean isRowUpdatePossible()
Specified by:
isRowUpdatePossible in interface PersistentCollection
Overrides:
isRowUpdatePossible in interface AbstractPersistentCollection

isSnapshotEmpty

public boolean isSnapshotEmpty(Serializable snapshot)
Specified by:
isSnapshotEmpty in interface PersistentCollection

isWrapper

public boolean isWrapper(Object collection)
Specified by:
isWrapper in interface PersistentCollection

iterator

public Iterator iterator()
See Also:
java.util.Set.iterator()

needsInserting

public boolean needsInserting(Object entry,
                              int i,
                              Type elemType)
            throws HibernateException
Specified by:
needsInserting in interface PersistentCollection

needsUpdating

public boolean needsUpdating(Object entry,
                             int i,
                             Type elemType)
Specified by:
needsUpdating in interface PersistentCollection

readFrom

public Object readFrom(ResultSet rs,
                       CollectionPersister persister,
                       CollectionAliases descriptor,
                       Object owner)
            throws HibernateException,
                   SQLException
Specified by:
readFrom in interface PersistentCollection

remove

public boolean remove(Object value)
See Also:
java.util.Set.remove(Object)

removeAll

public boolean removeAll(Collection coll)
See Also:
java.util.Set.removeAll(Collection)

retainAll

public boolean retainAll(Collection coll)
See Also:
java.util.Set.retainAll(Collection)

size

public int size()
See Also:
java.util.Set.size()

toArray

public Object[] toArray()
See Also:
java.util.Set.toArray()

toArray

public Object[] toArray(Object[] array)
See Also:
java.util.Set.toArray(Object[])

toString

public String toString()