Package org.hibernate.collection
Class PersistentMap
java.lang.Object
org.hibernate.collection.AbstractPersistentCollection
org.hibernate.collection.PersistentMap
- All Implemented Interfaces:
Serializable,Map,PersistentCollection
- Direct Known Subclasses:
PersistentSortedMap
A persistent wrapper for a java.util.Map. Underlying collection
is a HashMap.
- 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.PersistentMap(SessionImplementor session) Instantiates a lazy map (the underlying map is un-initialized).PersistentMap(SessionImplementor session, Map map) Instantiates a non-lazy map (the underlying map is constructed from the incoming map reference). -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeInitialize(CollectionPersister persister, int anticipatedSize) Called before any elements are read into the collection, allowing appropriate initializations to occur.voidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) disassemble(CollectionPersister persister) Disassemble the collection, ready for the cachebooleanempty()Is the initialized collection empty?entries(CollectionPersister persister) Iterate all collection entries, during update of the databasebooleanentryExists(Object entry, int i) Does an element exist at this entry in the collection?entrySet()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()booleanisSnapshotEmpty(Serializable snapshot) Is the snapshot empty?booleanIs this the wrapper for the given underlying collection instance?keySet()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?voidreadFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner) Read a row from the JDBC result setintsize()toString()values()Methods inherited from class org.hibernate.collection.AbstractPersistentCollection
afterInitialize, afterRowInsert, beginRead, clearDirty, dirty, endRead, forceInitialization, getCachedSize, getIdentifier, getKey, getOrphans, getOwner, getQueuedOrphans, getRole, getSession, getSnapshot, getStoredSnapshot, getValue, hasQueuedOperations, initialize, isClearQueueEnabled, isDirectlyAccessible, isDirty, isOperationQueueEnabled, isPutQueueEnabled, isRowUpdatePossible, 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.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
map
-
-
Constructor Details
-
PersistentMap
public PersistentMap()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. -
PersistentMap
Instantiates a lazy map (the underlying map is un-initialized).- Parameters:
session- The session to which this map will belong.
-
PersistentMap
Instantiates a non-lazy map (the underlying map is constructed from the incoming map reference).- Parameters:
session- The session to which this map will belong.map- The underlying map 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
-
isWrapper
Description copied from interface:PersistentCollectionIs this the wrapper for the given underlying collection instance?- Specified by:
isWrapperin 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.
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap- See Also:
-
containsValue
- Specified by:
containsValuein interfaceMap- See Also:
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
empty
public boolean empty()Description copied from class:AbstractPersistentCollectionIs the initialized collection empty?- Specified by:
emptyin interfacePersistentCollection- Specified by:
emptyin classAbstractPersistentCollection
-
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
-
entries
Description copied from interface:PersistentCollectionIterate all collection entries, during update of the database- Specified by:
entriesin interfacePersistentCollection
-
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
-
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- Throws:
HibernateException
-
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
-