Package org.hibernate.collection
Class PersistentSet
java.lang.Object
org.hibernate.collection.AbstractPersistentCollection
org.hibernate.collection.PersistentSet
- All Implemented Interfaces:
Serializable,Iterable,Collection,Set,PersistentCollection
- Direct Known Subclasses:
PersistentSortedSet
A persistent wrapper for a java.util.Set. The underlying
collection is a HashSet.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.hibernate.collection.AbstractPersistentCollection
AbstractPersistentCollection.DelayedOperation -
Field Summary
FieldsFields inherited from class org.hibernate.collection.AbstractPersistentCollection
UNKNOWN -
Constructor Summary
ConstructorsConstructorDescriptionEmpty 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
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection coll) voidbeforeInitialize(CollectionPersister persister, int anticipatedSize) Called before any elements are read into the collection, allowing appropriate initializations to occur.voidCalled just before reading any rows from the JDBC result setvoidclear()booleanbooleancontainsAll(Collection coll) disassemble(CollectionPersister persister) Disassemble the collection, ready for the cachebooleanempty()Is the initialized collection empty?booleanendRead()Called after reading all rows from the JDBC result setentries(CollectionPersister persister) Iterate all collection entries, during update of the databasebooleanentryExists(Object key, int i) Does an element exist at this entry in the collection?booleanbooleanequalsSnapshot(CollectionPersister persister) Does the current state exactly match the snapshot?getDeletes(CollectionPersister persister, boolean indexIsFormula) Get all the elements that need deletinggetElement(Object entry) Get the value of the given collection entrygetIndex(Object entry, int i, CollectionPersister persister) Get the index of the given collection entrygetOrphans(Serializable snapshot, String entityName) get all "orphaned" elementsgetSnapshot(CollectionPersister persister) Return a new snapshot of the current state of the collectiongetSnapshotElement(Object entry, int i) Get the snapshot value of the given collection entryinthashCode()voidinitializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner) Read the state of the collection from a disassembled cached valuebooleanisEmpty()booleanbooleanisSnapshotEmpty(Serializable snapshot) Is the snapshot empty?booleanIs this the wrapper for the given underlying collection instance?iterator()booleanneedsInserting(Object entry, int i, Type elemType) Do we need to insert this element?booleanneedsUpdating(Object entry, int i, Type elemType) Do we need to update this element?readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner) Read a row from the JDBC result setbooleanbooleanremoveAll(Collection coll) booleanretainAll(Collection coll) intsize()Object[]toArray()Object[]toString()Methods inherited from class org.hibernate.collection.AbstractPersistentCollection
afterInitialize, afterRowInsert, clearDirty, dirty, forceInitialization, getCachedSize, getIdentifier, getKey, getOrphans, getOwner, getQueuedOrphans, getRole, getSession, getSnapshot, getStoredSnapshot, getValue, hasQueuedOperations, initialize, isClearQueueEnabled, isDirectlyAccessible, isDirty, isOperationQueueEnabled, isPutQueueEnabled, isUnreferenced, needsRecreate, performQueuedOperations, postAction, preInsert, queuedAdditionIterator, queueOperation, read, readElementByIndex, readElementExistence, readIndexExistence, readSize, setCurrentSession, setDirectlyAccessible, setInitialized, setOwner, setSnapshot, unsetSession, wasInitialized, writeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Field Details
-
set
-
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
Constructor matching super. Instantiates a lazy set (the underlying set is un-initialized).- Parameters:
session- The session to which this set will belong.
-
PersistentSet
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
-
getSnapshot
Description copied from interface:PersistentCollectionReturn a new snapshot of the current state of the collection- Specified by:
getSnapshotin interfacePersistentCollection- Throws:
HibernateException
-
getOrphans
Description copied from class:AbstractPersistentCollectionget all "orphaned" elements- Specified by:
getOrphansin interfacePersistentCollection- Specified by:
getOrphansin classAbstractPersistentCollection- Throws:
HibernateException
-
equalsSnapshot
Description copied from interface:PersistentCollectionDoes the current state exactly match the snapshot?- Specified by:
equalsSnapshotin interfacePersistentCollection- Throws:
HibernateException
-
isSnapshotEmpty
Description copied from interface:PersistentCollectionIs the snapshot empty?- Specified by:
isSnapshotEmptyin interfacePersistentCollection
-
beforeInitialize
Description copied from interface:PersistentCollectionCalled before any elements are read into the collection, allowing appropriate initializations to occur.- Specified by:
beforeInitializein interfacePersistentCollection- Parameters:
persister- The underlying collection persister.anticipatedSize- The anticipated size of the collection after initilization is complete.
-
initializeFromCache
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException Description copied from interface:PersistentCollectionRead the state of the collection from a disassembled cached value- Specified by:
initializeFromCachein interfacePersistentCollection- Throws:
HibernateException
-
empty
public boolean empty()Description copied from class:AbstractPersistentCollectionIs the initialized collection empty?- Specified by:
emptyin interfacePersistentCollection- Specified by:
emptyin classAbstractPersistentCollection
-
size
public int size()- Specified by:
sizein interfaceCollection- Specified by:
sizein interfaceSet- See Also:
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection- Specified by:
isEmptyin interfaceSet- See Also:
-
contains
- Specified by:
containsin interfaceCollection- Specified by:
containsin interfaceSet- See Also:
-
iterator
-
toArray
- Specified by:
toArrayin interfaceCollection- Specified by:
toArrayin interfaceSet- See Also:
-
toArray
- Specified by:
toArrayin interfaceCollection- Specified by:
toArrayin interfaceSet- See Also:
-
add
- Specified by:
addin interfaceCollection- Specified by:
addin interfaceSet- See Also:
-
remove
- Specified by:
removein interfaceCollection- Specified by:
removein interfaceSet- See Also:
-
containsAll
- Specified by:
containsAllin interfaceCollection- Specified by:
containsAllin interfaceSet- See Also:
-
addAll
- Specified by:
addAllin interfaceCollection- Specified by:
addAllin interfaceSet- See Also:
-
retainAll
- Specified by:
retainAllin interfaceCollection- Specified by:
retainAllin interfaceSet- See Also:
-
removeAll
- Specified by:
removeAllin interfaceCollection- Specified by:
removeAllin interfaceSet- See Also:
-
clear
public void clear()- Specified by:
clearin interfaceCollection- Specified by:
clearin interfaceSet- See Also:
-
toString
-
readFrom
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner) throws HibernateException, SQLException Description copied from interface:PersistentCollectionRead a row from the JDBC result set- Specified by:
readFromin interfacePersistentCollection- Throws:
HibernateExceptionSQLException
-
beginRead
public void beginRead()Description copied from class:AbstractPersistentCollectionCalled just before reading any rows from the JDBC result set- Specified by:
beginReadin interfacePersistentCollection- Overrides:
beginReadin classAbstractPersistentCollection
-
endRead
public boolean endRead()Description copied from class:AbstractPersistentCollectionCalled after reading all rows from the JDBC result set- Specified by:
endReadin interfacePersistentCollection- Overrides:
endReadin classAbstractPersistentCollection
-
entries
Description copied from interface:PersistentCollectionIterate all collection entries, during update of the database- Specified by:
entriesin interfacePersistentCollection
-
disassemble
Description copied from interface:PersistentCollectionDisassemble the collection, ready for the cache- Specified by:
disassemblein interfacePersistentCollection- Throws:
HibernateException
-
getDeletes
public Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException Description copied from interface:PersistentCollectionGet all the elements that need deleting- Specified by:
getDeletesin interfacePersistentCollection- Throws:
HibernateException
-
needsInserting
Description copied from interface:PersistentCollectionDo we need to insert this element?- Specified by:
needsInsertingin interfacePersistentCollection- Throws:
HibernateException
-
needsUpdating
Description copied from interface:PersistentCollectionDo we need to update this element?- Specified by:
needsUpdatingin interfacePersistentCollection
-
isRowUpdatePossible
public boolean isRowUpdatePossible()- Specified by:
isRowUpdatePossiblein interfacePersistentCollection- Overrides:
isRowUpdatePossiblein classAbstractPersistentCollection
-
getIndex
Description copied from interface:PersistentCollectionGet the index of the given collection entry- Specified by:
getIndexin interfacePersistentCollection- Parameters:
persister- it was more elegant before we added this...
-
getElement
Description copied from interface:PersistentCollectionGet the value of the given collection entry- Specified by:
getElementin interfacePersistentCollection
-
getSnapshotElement
Description copied from interface:PersistentCollectionGet the snapshot value of the given collection entry- Specified by:
getSnapshotElementin interfacePersistentCollection
-
equals
-
hashCode
public int hashCode() -
entryExists
Description copied from interface:PersistentCollectionDoes an element exist at this entry in the collection?- Specified by:
entryExistsin interfacePersistentCollection
-
isWrapper
Description copied from interface:PersistentCollectionIs this the wrapper for the given underlying collection instance?- Specified by:
isWrapperin interfacePersistentCollection
-