Z - the source typeE - the element typeC - the collection typepublic class PluralAssociationMapping<Z,C,E> extends AssociationMapping<Z,C,E> implements PluralMapping<Z,C,E>
JoinedMapping.MappingType| Constructor and Description |
|---|
PluralAssociationMapping(ParentMapping<?,Z> parent,
PluralAttributeImpl<? super Z,C,E> attribute) |
| Modifier and Type | Method and Description |
|---|---|
void |
attach(Connection connection,
ManagedInstance<?> instance,
Joinable[] batch,
int batchSize)
Attaches the child.
|
void |
checkTransient(ManagedInstance<?> managedInstance)
Checks that the association references not a transient instance
|
void |
detach(Connection connection,
ManagedInstance<?> instance,
Object key,
Object child)
detaches the child.
|
void |
detachAll(Connection connection,
ManagedInstance<?> instance)
Details all the children.
|
void |
enhance(ManagedInstance<?> instance)
Enhances the collection to the managed collection
|
Object |
extractKey(Object value)
Extracts key from the value.
|
void |
flush(Connection connection,
ManagedInstance<?> managedInstance,
boolean removals,
boolean force)
Flushes the associates.
|
PluralAttributeImpl<? super Z,C,E> |
getAttribute()
Returns the attribute of the mapping.
|
ForeignKey |
getForeignKey()
Returns the foreign key of the mapping.
|
AssociationMapping<?,?,?> |
getInverse()
Returns the inverse attribute.
|
SingularMapping<? super E,?> |
getMapKeyIdMapping()
Returns the key mapping of the association.
|
Pair<SingularMapping<? super E,?>,org.batoo.common.reflect.AbstractAccessor>[] |
getMapKeyIdMappings()
Returns the map key id mappings of the association.
|
Mapping<?,?,?> |
getMapping(String path)
Returns child mapping of the
type. |
JoinedMapping.MappingType |
getMappingType()
Returns the type of the mapping.
|
String |
getOrderBy()
Returns the order by of the association.
|
OrderColumn |
getOrderColumn()
Returns the order column.
|
JoinTable |
getTable()
Returns the join table of the mapping.
|
EntityTypeImpl<E> |
getType()
Returns the bindable entity type.
|
void |
initialize(ManagedInstance<?> instance)
Initializes the mapping.
|
boolean |
isAssociation()
Returns if the mapping is an association.
|
boolean |
isJoined()
Returns if the mapping is a joined mapping.
|
boolean |
isMap()
Returns if the mapping is a map collection.
|
void |
link()
Links the attribute to its associate entity type and inverse attribute if bidirectional.
|
void |
load(ManagedInstance<?> instance)
Loads the collection eagerly.
|
Collection<? extends E> |
loadCollection(ManagedInstance<?> managedInstance)
Loads and returns the collection.
|
<K> Map<? extends K,? extends E> |
loadMap(ManagedInstance<?> instance)
Loads and returns the map
|
void |
mergeWith(EntityManagerImpl entityManager,
ManagedInstance<?> instance,
Object entity,
org.apache.commons.lang.mutable.MutableBoolean requiresFlush,
IdentityHashMap<Object,Object> processed)
Merges the association of the instance with the entity.
|
void |
persistAdditions(EntityManagerImpl entityManager,
ManagedInstance<?> instance)
Persists the children that have been added to the managed collection
|
boolean |
references(Object instance,
Object reference) |
void |
refresh(ManagedInstance<?> instance,
Set<Object> processed)
Refreshes the association
|
void |
removeOrphans(EntityManagerImpl entityManager,
ManagedInstance<?> instance)
Removes the children that have been orphaned due to removal from the managed collection
|
void |
setCollection(ManagedInstance<?> instance,
Collection<? extends E> children)
Sets the collection manually for the mapping.
|
void |
setInverse(AssociationMapping<?,?,?> inverse)
Sets the inverse attribute.
|
void |
setLazy(ManagedInstance<?> instance)
Sets the lazy instance for the collection
|
void |
sortList(Object instance)
Sorts the managed list of the instance
|
cascadesDetach, cascadesMerge, cascadesPersist, cascadesRefresh, cascadesRemove, getAssociationMetadata, getFetchStrategy, getMappedBy, getMaxFetchJoinDepth, getSelectCriteria, isEager, isId, isOwner, isOwnerSelect, join, removesOrphansequals, get, getIdType, getJavaType, getName, getParent, getPath, getRoot, hashCode, set, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcascadesMerge, get, getRootgetPath, isEager, joinpublic PluralAssociationMapping(ParentMapping<?,Z> parent, PluralAttributeImpl<? super Z,C,E> attribute)
parent - the parent mappingattribute - the attributepublic void attach(Connection connection, ManagedInstance<?> instance, Joinable[] batch, int batchSize) throws SQLException
attach in interface PluralMapping<Z,C,E>connection - the connectioninstance - the instancebatch - the batch of childrenbatchSize - the size of the batchSQLException - thrown in case of an SQL errorpublic void checkTransient(ManagedInstance<?> managedInstance)
checkTransient in class AssociationMapping<Z,C,E>managedInstance - the managed instancepublic void detach(Connection connection, ManagedInstance<?> instance, Object key, Object child) throws SQLException
detach in interface PluralMapping<Z,C,E>connection - the connectioninstance - the instancekey - the key, may be nullchild - the childSQLException - thrown in case of an SQL errorpublic void detachAll(Connection connection, ManagedInstance<?> instance) throws SQLException
detachAll in interface PluralMapping<Z,C,E>connection - the connectioninstance - the instanceSQLException - thrown in case of an SQL errorpublic void enhance(ManagedInstance<?> instance)
enhance in interface PluralMapping<Z,C,E>instance - the managed instancepublic Object extractKey(Object value)
extractKey in interface JoinedMapping<Z,C,E>value - the valuepublic void flush(Connection connection, ManagedInstance<?> managedInstance, boolean removals, boolean force) throws SQLException
flush in interface JoinedMapping<Z,C,E>connection - the connection to usemanagedInstance - the managed instanceremovals - true if the removals should be flushed and false for the additionsforce - true to force, effective only for insertions and for new entities.SQLException - thrown if there is an underlying SQL Exceptionpublic PluralAttributeImpl<? super Z,C,E> getAttribute()
getAttribute in interface JoinedMapping<Z,C,E>getAttribute in class Mapping<Z,C,E>public ForeignKey getForeignKey()
getForeignKey in class AssociationMapping<Z,C,E>public AssociationMapping<?,?,?> getInverse()
getInverse in class AssociationMapping<Z,C,E>public SingularMapping<? super E,?> getMapKeyIdMapping()
public Pair<SingularMapping<? super E,?>,org.batoo.common.reflect.AbstractAccessor>[] getMapKeyIdMappings()
public Mapping<?,?,?> getMapping(String path)
type.getMapping in interface PluralMapping<Z,C,E>path - the pathpublic JoinedMapping.MappingType getMappingType()
getMappingType in interface JoinedMapping<Z,C,E>public String getOrderBy()
getOrderBy in interface PluralMapping<Z,C,E>public OrderColumn getOrderColumn()
getOrderColumn in interface PluralMapping<Z,C,E>public JoinTable getTable()
getTable in interface JoinedMapping<Z,C,E>getTable in class AssociationMapping<Z,C,E>public EntityTypeImpl<E> getType()
getType in interface JoinedMapping<Z,C,E>getType in class AssociationMapping<Z,C,E>public void initialize(ManagedInstance<?> instance)
initialize in interface JoinedMapping<Z,C,E>instance - the instancepublic boolean isAssociation()
isAssociation in interface JoinedMapping<Z,C,E>public boolean isJoined()
isJoined in interface JoinedMapping<Z,C,E>public boolean isMap()
isMap in interface JoinedMapping<Z,C,E>public void link()
throws MappingException
link in class AssociationMapping<Z,C,E>MappingException - thrown in case of a linkage errorpublic void load(ManagedInstance<?> instance)
load in interface PluralMapping<Z,C,E>instance - the managed instancepublic Collection<? extends E> loadCollection(ManagedInstance<?> managedInstance)
loadCollection in interface PluralMapping<Z,C,E>managedInstance - the managed instance owning the collectionpublic <K> Map<? extends K,? extends E> loadMap(ManagedInstance<?> instance)
loadMap in interface PluralMapping<Z,C,E>K - the key type of the mappublic void mergeWith(EntityManagerImpl entityManager, ManagedInstance<?> instance, Object entity, org.apache.commons.lang.mutable.MutableBoolean requiresFlush, IdentityHashMap<Object,Object> processed)
mergeWith in class AssociationMapping<Z,C,E>entityManager - the entity managerinstance - the instanceentity - the entityrequiresFlush - if an implicit flush is requiredprocessed - registry of processed entitiespublic void persistAdditions(EntityManagerImpl entityManager, ManagedInstance<?> instance)
entityManager - the entity managerinstance - the managed instancepublic boolean references(Object instance, Object reference)
references in class AssociationMapping<Z,C,E>instance - the source instancereference - the associate instancepublic void refresh(ManagedInstance<?> instance, Set<Object> processed)
refresh in class AssociationMapping<Z,C,E>instance - the instance that is the owner of the associationprocessed - the set of processed instancespublic void removeOrphans(EntityManagerImpl entityManager, ManagedInstance<?> instance)
entityManager - the entity managerinstance - the managed instancepublic void setCollection(ManagedInstance<?> instance, Collection<? extends E> children)
setCollection in interface PluralMapping<Z,C,E>instance - the managed instancechildren - the collection of childrenpublic void setInverse(AssociationMapping<?,?,?> inverse)
setInverse in class AssociationMapping<Z,C,E>inverse - the inverse associationpublic void setLazy(ManagedInstance<?> instance)
setLazy in interface PluralMapping<Z,C,E>instance - the managed instanceCopyright © 2012 Batoo Software & Consultancy. All Rights Reserved.