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

    java.lang.Object
      org.hibernate.collection.AbstractPersistentCollection
          org.hibernate.collection.PersistentIdentifierBag

All Implemented Interfaces:
  Serializable, Iterable, Collection, List, PersistentCollection

    public class PersistentIdentifierBag

extends AbstractPersistentCollection
implements List

An `IdentifierBag` implements "bag" semantics more efficiently than a regular `Bag` by adding a synthetic identifier column to the table. This identifier is unique for all rows in the table, allowing very efficient updates and deletes. The value of the identifier is never exposed to the application.
`IdentifierBag`s may not be used for a many-to-one association. Furthermore, there is no reason to use `inverse="true"`.

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 Map` | `identifiers`
`protected List` | `values`

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

Constructor Summary
`PersistentIdentifierBag()`
`PersistentIdentifierBag(SessionImplementor session)`
`PersistentIdentifierBag(SessionImplementor session, Collection coll)`

Method Summary
`void` | `add(int index, Object element)`
`boolean` | `add(Object o)`
`boolean` | `addAll(Collection c)`
`boolean` | `addAll(int index, Collection c)`
`void` | `afterRowInsert(CollectionPersister persister, Object entry, int i)` Called after inserting a row, to fetch the natively generated id
`void` | `beforeInitialize(CollectionPersister persister, int anticipatedSize)` Called before any elements are read into the collection, allowing appropriate initializations to occur.
`void` | `clear()`
`boolean` | `contains(Object o)`
`boolean` | `containsAll(Collection c)`
`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?
`boolean` | `equalsSnapshot(CollectionPersister persister)` Does the current state exactly match the snapshot?
`Object` | `get(int index)`
`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` | `getIdentifier(Object entry, int i)` Get the index 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` | `indexOf(Object o)`
`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?
`Iterator` | `iterator()`
`int` | `lastIndexOf(Object o)`
`ListIterator` | `listIterator()`
`ListIterator` | `listIterator(int index)`
`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?
`void` | `preInsert(CollectionPersister persister)` Called before inserting rows, to ensure that any surrogate keys are fully generated
`Object` | `readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)` Read a row from the JDBC result set
`Object` | `remove(int index)`
`boolean` | `remove(Object o)`
`boolean` | `removeAll(Collection c)`
`boolean` | `retainAll(Collection c)`
`Object` | `set(int index, Object element)`
`int` | `size()`
`List` | `subList(int fromIndex, int toIndex)`
`Object[]` | `toArray()`
`Object[]` | `toArray(Object[] a)`

Methods inherited from class org.hibernate.collection.AbstractPersistentCollection
`afterInitialize, beginRead, clearDirty, dirty, endRead, forceInitialization, getCachedSize, getKey, getOrphans, getOwner, getQueuedOrphans, getRole, getSession, getSnapshot, getStoredSnapshot, getValue, hasQueuedOperations, initialize, isClearQueueEnabled, isDirectlyAccessible, isDirty, isOperationQueueEnabled, isPutQueueEnabled, isRowUpdatePossible, isUnreferenced, needsRecreate, performQueuedOperations, postAction, 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`

Methods inherited from interface java.util.List
`equals, hashCode`

Field Detail

### values

    protected List values

### identifiers

    protected Map identifiers

Constructor Detail

### PersistentIdentifierBag

    public PersistentIdentifierBag(SessionImplementor session)

### PersistentIdentifierBag

    public PersistentIdentifierBag()

### PersistentIdentifierBag

    public PersistentIdentifierBag(SessionImplementor session,
                                   Collection coll)

Method Detail

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

### getIdentifier

    public Object getIdentifier(Object entry,
                                int i)

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

  Specified by:
    `getIdentifier` in interface `PersistentCollection`
  Overrides:
    `getIdentifier` in class `AbstractPersistentCollection`

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

### add

    public boolean add(Object o)

  Specified by:
    `add` in interface `Collection`
  Specified by:
    `add` in interface `List`

### clear

    public void clear()

  Specified by:
    `clear` in interface `Collection`
  Specified by:
    `clear` in interface `List`

### contains

    public boolean contains(Object o)

  Specified by:
    `contains` in interface `Collection`
  Specified by:
    `contains` in interface `List`

### containsAll

    public boolean containsAll(Collection c)

  Specified by:
    `containsAll` in interface `Collection`
  Specified by:
    `containsAll` in interface `List`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `Collection`
  Specified by:
    `isEmpty` in interface `List`

### iterator

    public Iterator iterator()

  Specified by:
    `iterator` in interface `Iterable`
  Specified by:
    `iterator` in interface `Collection`
  Specified by:
    `iterator` in interface `List`

### remove

    public boolean remove(Object o)

  Specified by:
    `remove` in interface `Collection`
  Specified by:
    `remove` in interface `List`

### removeAll

    public boolean removeAll(Collection c)

  Specified by:
    `removeAll` in interface `Collection`
  Specified by:
    `removeAll` in interface `List`

### retainAll

    public boolean retainAll(Collection c)

  Specified by:
    `retainAll` in interface `Collection`
  Specified by:
    `retainAll` in interface `List`

### size

    public int size()

  Specified by:
    `size` in interface `Collection`
  Specified by:
    `size` in interface `List`

### toArray

    public Object[] toArray()

  Specified by:
    `toArray` in interface `Collection`
  Specified by:
    `toArray` in interface `List`

### toArray

    public Object[] toArray(Object[] a)

  Specified by:
    `toArray` in interface `Collection`
  Specified by:
    `toArray` in interface `List`

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

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

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

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

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

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

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

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

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

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

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

### preInsert

    public void preInsert(CollectionPersister persister)
                   throws HibernateException

  Description copied from class: `AbstractPersistentCollection`
  Called before inserting rows, to ensure that any surrogate keys are fully generated

  Specified by:
    `preInsert` in interface `PersistentCollection`
  Overrides:
    `preInsert` in class `AbstractPersistentCollection`
  Throws:
    `HibernateException`

### add

    public void add(int index,
                    Object element)

  Specified by:
    `add` in interface `List`

### addAll

    public boolean addAll(int index,
                          Collection c)

  Specified by:
    `addAll` in interface `List`

### get

    public Object get(int index)

  Specified by:
    `get` in interface `List`

### indexOf

    public int indexOf(Object o)

  Specified by:
    `indexOf` in interface `List`

### lastIndexOf

    public int lastIndexOf(Object o)

  Specified by:
    `lastIndexOf` in interface `List`

### listIterator

    public ListIterator listIterator()

  Specified by:
    `listIterator` in interface `List`

### listIterator

    public ListIterator listIterator(int index)

  Specified by:
    `listIterator` in interface `List`

### remove

    public Object remove(int index)

  Specified by:
    `remove` in interface `List`

### set

    public Object set(int index,
                      Object element)

  Specified by:
    `set` in interface `List`

### subList

    public List subList(int fromIndex,
                        int toIndex)

  Specified by:
    `subList` in interface `List`

### addAll

    public boolean addAll(Collection c)

  Specified by:
    `addAll` in interface `Collection`
  Specified by:
    `addAll` in interface `List`

### afterRowInsert

    public void afterRowInsert(CollectionPersister persister,
                               Object entry,
                               int i)
                        throws HibernateException

  Description copied from class: `AbstractPersistentCollection`
  Called after inserting a row, to fetch the natively generated id

  Specified by:
    `afterRowInsert` in interface `PersistentCollection`
  Overrides:
    `afterRowInsert` in class `AbstractPersistentCollection`
  Throws:
    `HibernateException`

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