public class

CustomCollectionType

extends CollectionType
java.lang.Object
   ↳ org.hibernate.type.AbstractType
     ↳ org.hibernate.type.CollectionType
       ↳ org.hibernate.type.CustomCollectionType

Class Overview

A custom type for mapping user-written classes that implement PersistentCollection

Summary

[Expand]
Inherited Fields
From class org.hibernate.type.CollectionType
Public Constructors
CustomCollectionType(TypeFactory.TypeScope typeScope, Class userTypeClass, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML)
Public Methods
boolean contains(Object collection, Object entity, SessionImplementor session)
Iterator getElementsIterator(Object collection)
Get an iterator over the element set of the collection in POJO mode
Class getReturnedClass()
UserCollectionType getUserType()
Object indexOf(Object collection, Object entity)
Object instantiate(int anticipatedType)
Instantiate an empty instance of the "underlying" collection (not a wrapper), but with the given anticipated size (i.e.
PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key)
Instantiate an uninitialized collection wrapper or holder.
Object replaceElements(Object original, Object target, Object owner, Map copyCache, SessionImplementor session)
Replace the elements of a collection with the elements of another collection.
PersistentCollection wrap(SessionImplementor session, Object collection)
Wrap the naked collection instance in a wrapper, or instantiate a holder.
Protected Methods
String renderLoggableString(Object value, SessionFactoryImplementor factory)
[Expand]
Inherited Methods
From class org.hibernate.type.CollectionType
From class org.hibernate.type.AbstractType
From class java.lang.Object
From interface org.hibernate.type.AssociationType
From interface org.hibernate.type.Type

Public Constructors

public CustomCollectionType (TypeFactory.TypeScope typeScope, Class userTypeClass, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML)

Public Methods

public boolean contains (Object collection, Object entity, SessionImplementor session)

public Iterator getElementsIterator (Object collection)

Get an iterator over the element set of the collection in POJO mode

Parameters
collection The collection to be iterated
Returns
  • The iterator.

public Class getReturnedClass ()

public UserCollectionType getUserType ()

public Object indexOf (Object collection, Object entity)

public Object instantiate (int anticipatedType)

Instantiate an empty instance of the "underlying" collection (not a wrapper), but with the given anticipated size (i.e. accounting for initial capacity and perhaps load factor).

Parameters
anticipatedType The anticipated size of the instaniated collection after we are done populating it.
Returns
  • A newly instantiated collection to be wrapped.

public PersistentCollection instantiate (SessionImplementor session, CollectionPersister persister, Serializable key)

Instantiate an uninitialized collection wrapper or holder. Callers MUST add the holder to the persistence context!

Parameters
session The session from which the request is originating.
persister The underlying collection persister (metadata)
key The owner key.
Returns
  • The instantiated collection.

public Object replaceElements (Object original, Object target, Object owner, Map copyCache, SessionImplementor session)

Replace the elements of a collection with the elements of another collection.

Parameters
original The 'source' of the replacement elements (where we copy from)
target The target of the replacement elements (where we copy to)
owner The owner of the collection being merged
copyCache The map of elements already replaced.
session The session from which the merge event originated.
Returns
  • The merged collection.

public PersistentCollection wrap (SessionImplementor session, Object collection)

Wrap the naked collection instance in a wrapper, or instantiate a holder. Callers MUST add the holder to the persistence context!

Parameters
session The session from which the request is originating.
collection The bare collection to be wrapped.
Returns
  • The wrapped collection.

Protected Methods

protected String renderLoggableString (Object value, SessionFactoryImplementor factory)