PersistentMap (Hibernate JavaDocs)
Date: 2012-04-05

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.collection.internal
Class PersistentMap

    java.lang.Object
      org.hibernate.collection.internal.AbstractPersistentCollection
          org.hibernate.collection.internal.PersistentMap

All Implemented Interfaces:
  Serializable, Map, PersistentCollection

Direct Known Subclasses:
  PersistentSortedMap

    public class PersistentMap

extends AbstractPersistentCollection
implements Map

A persistent wrapper for a `java.util.Map`. Underlying collection is a `HashMap`.

See Also:
  `HashMap`, Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.hibernate.collection.internal.AbstractPersistentCollection
`AbstractPersistentCollection.DelayedOperation, AbstractPersistentCollection.IteratorProxy, AbstractPersistentCollection.ListIteratorProxy, AbstractPersistentCollection.ListProxy, AbstractPersistentCollection.SetProxy`

Nested classes/interfaces inherited from interface java.util.Map
`Map.Entry<K,V>`

Field Summary
`protected Map` | `map`

Fields inherited from class org.hibernate.collection.internal.AbstractPersistentCollection
`UNKNOWN`

Constructor Summary
`PersistentMap()` Empty 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
`void` | `beforeInitialize(CollectionPersister persister, int anticipatedSize)` Called before any elements are read into the collection, allowing appropriate initializations to occur.
`void` | `clear()`
`boolean` | `containsKey(Object key)`
`boolean` | `containsValue(Object value)`
`Serializable` | `disassemble(CollectionPersister persister)` Disassemble the collection, ready for the cache
`boolean` | `empty()` Is the initialized collection empty?
`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?
`Set` | `entrySet()`
`boolean` | `equals(Object other)`
`boolean` | `equalsSnapshot(CollectionPersister persister)` Does the current state exactly match the snapshot?
`Object` | `get(Object key)`
`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
`int` | `hashCode()`
`void` | `initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)` Read the state of the collection from a disassembled cached value
`boolean` | `isEmpty()`
`boolean` | `isSnapshotEmpty(Serializable snapshot)` Is the snapshot empty?
`boolean` | `isWrapper(Object collection)` Is this the wrapper for the given underlying collection instance?
`Set` | `keySet()`
`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` | `put(Object key, Object value)`
`void` | `putAll(Map puts)`
`Object` | `readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)` Read a row from the JDBC result set
`Object` | `remove(Object key)`
`int` | `size()`
`String` | `toString()`
`Collection` | `values()`

Methods inherited from class org.hibernate.collection.internal.AbstractPersistentCollection
`afterInitialize, afterRowInsert, beginRead, clearDirty, dirty, endRead, forceInitialization, getCachedSize, getIdentifier, getKey, getOrphans, getOwner, getQueuedOrphans, getRole, getSession, getSnapshot, getStoredSnapshot, getValue, hasQueuedOperations, identityRemove, 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, write`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### map

    protected Map map

Constructor Detail

### 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

    public PersistentMap(SessionImplementor session)

  Instantiates a lazy map (the underlying map is un-initialized).

  Parameters:
    `session` - The session to which this map will belong.

### PersistentMap

    public PersistentMap(SessionImplementor session,
                         Map map)

  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 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

  Specified by:
    `getSnapshot` in interface `PersistentCollection`
  Throws:
    `HibernateException`

### 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`

### equalsSnapshot

    public boolean equalsSnapshot(CollectionPersister persister)
                           throws HibernateException

  Description copied from interface: `PersistentCollection`
  Does the current state exactly match the snapshot?

  Specified by:
    `equalsSnapshot` in interface `PersistentCollection`
  Throws:
    `HibernateException`

### isSnapshotEmpty

    public boolean isSnapshotEmpty(Serializable snapshot)

  Description copied from interface: `PersistentCollection`
  Is the snapshot empty?

  Specified by:
    `isSnapshotEmpty` in interface `PersistentCollection`

### isWrapper

    public boolean isWrapper(Object collection)

  Description copied from interface: `PersistentCollection`
  Is this the wrapper for the given underlying collection instance?

  Specified by:
    `isWrapper` in interface `PersistentCollection`

### 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.

  Specified by:
    `beforeInitialize` in interface `PersistentCollection`
  Parameters:
    `persister` - The underlying collection persister.
    `anticipatedSize` - The anticipated size of the collection after initilization is complete.

### size

    public int size()

  Specified by:
    `size` in interface `Map`
  See Also:
    `Map.size()`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `Map`
  See Also:
    `Map.isEmpty()`

### containsKey

    public boolean containsKey(Object key)

  Specified by:
    `containsKey` in interface `Map`
  See Also:
    `Map.containsKey(Object)`

### containsValue

    public boolean containsValue(Object value)

  Specified by:
    `containsValue` in interface `Map`
  See Also:
    `Map.containsValue(Object)`

### get

    public Object get(Object key)

  Specified by:
    `get` in interface `Map`
  See Also:
    `Map.get(Object)`

### put

    public Object put(Object key,
                      Object value)

  Specified by:
    `put` in interface `Map`
  See Also:
    `Map.put(Object, Object)`

### remove

    public Object remove(Object key)

  Specified by:
    `remove` in interface `Map`
  See Also:
    `Map.remove(Object)`

### putAll

    public void putAll(Map puts)

  Specified by:
    `putAll` in interface `Map`
  See Also:
    `Map.putAll(java.util.Map puts)`

### clear

    public void clear()

  Specified by:
    `clear` in interface `Map`
  See Also:
    `Map.clear()`

### keySet

    public Set keySet()

  Specified by:
    `keySet` in interface `Map`
  See Also:
    `Map.keySet()`

### values

    public Collection values()

  Specified by:
    `values` in interface `Map`
  See Also:
    `Map.values()`

### entrySet

    public Set entrySet()

  Specified by:
    `entrySet` in interface `Map`
  See Also:
    `Map.entrySet()`

### 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`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### 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

  Specified by:
    `readFrom` in interface `PersistentCollection`
  Throws:
    `HibernateException`
    `SQLException`

### entries

    public Iterator entries(CollectionPersister persister)

  Description copied from interface: `PersistentCollection`
  Iterate all collection entries, during update of the database

  Specified by:
    `entries` in interface `PersistentCollection`

### 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

  Specified by:
    `initializeFromCache` in interface `PersistentCollection`
  Throws:
    `HibernateException`

### disassemble

    public Serializable disassemble(CollectionPersister persister)
                             throws HibernateException

  Description copied from interface: `PersistentCollection`
  Disassemble the collection, ready for the cache

  Specified by:
    `disassemble` in interface `PersistentCollection`
  Throws:
    `HibernateException`

### getDeletes

    public Iterator getDeletes(CollectionPersister persister,
                               boolean indexIsFormula)
                        throws HibernateException

  Description copied from interface: `PersistentCollection`
  Get all the elements that need deleting

  Specified by:
    `getDeletes` in interface `PersistentCollection`
  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?

  Specified by:
    `needsInserting` in interface `PersistentCollection`
  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?

  Specified by:
    `needsUpdating` in interface `PersistentCollection`
  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

  Specified by:
    `getIndex` in interface `PersistentCollection`
    `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

  Specified by:
    `getElement` in interface `PersistentCollection`

### getSnapshotElement

    public Object getSnapshotElement(Object entry,
                                     int i)

  Description copied from interface: `PersistentCollection`
  Get the snapshot value of the given collection entry

  Specified by:
    `getSnapshotElement` in interface `PersistentCollection`

### equals

    public boolean equals(Object other)

  Specified by:
    `equals` in interface `Map`
  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `Map`
  Overrides:
    `hashCode` in class `Object`

### entryExists

    public boolean entryExists(Object entry,
                               int i)

  Description copied from interface: `PersistentCollection`
  Does an element exist at this entry in the collection?

  Specified by:
    `entryExists` in interface `PersistentCollection`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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