Z - the source typeE - the element typeC - the collection typepublic class PluralAssociationMappingImpl<Z,C,E> extends AssociationMappingImpl<Z,C,E> implements PluralMappingEx<Z,C,E>
| Constructor and Description |
|---|
PluralAssociationMappingImpl(AbstractParentMapping<?,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() |
AssociationMappingImpl<?,?,?> |
getInverse()
Returns the inverse attribute.
|
JoinTable |
getJoinTable()
Returns the join table of the mapping.
|
SingularMappingEx<? super E,?> |
getMapKeyIdMapping()
Returns the key mapping of the association.
|
org.batoo.jpa.core.util.Pair<SingularMapping<?,?>,org.batoo.common.reflect.AbstractAccessor>[] |
getMapKeyIdMappings()
Returns the map key id mappings of the association.
|
AbstractMapping<?,?,?> |
getMapping(String path)
Returns child mapping of the
type. |
MappingType |
getMappingType()
Returns the type of the mapping.
|
String |
getOrderBy()
Returns the order by of the association.
|
OrderColumn |
getOrderColumn()
Returns the order column.
|
EntityTypeImpl<E> |
getType()
Returns the associate type of the mapping.
|
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,
LinkedList<ManagedInstance<?>> instances)
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(AssociationMappingImpl<?,?,?> 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, isOwner, isOwnerSelect, join, removesOrphansequals, get, getJavaMember, getJavaType, getLocator, getName, getParent, getPath, getRoot, hashCode, isCollection, set, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcascadesMergeisEager, joinget, getJavaMember, getJavaType, getLocator, getName, getParent, getPath, getRoot, isCollection, setpublic PluralAssociationMappingImpl(AbstractParentMapping<?,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 PluralMappingEx<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 AssociationMappingImpl<Z,C,E>managedInstance - the managed instancepublic void detach(Connection connection, ManagedInstance<?> instance, Object key, Object child) throws SQLException
detach in interface PluralMappingEx<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 PluralMappingEx<Z,C,E>connection - the connectioninstance - the instanceSQLException - thrown in case of an SQL errorpublic void enhance(ManagedInstance<?> instance)
enhance in interface PluralMappingEx<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>flush in class AssociationMappingImpl<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 AbstractMapping<Z,C,E>public ForeignKey getForeignKey()
getForeignKey in interface AssociationMapping<Z,C,E>public AssociationMappingImpl<?,?,?> getInverse()
getInverse in class AssociationMappingImpl<Z,C,E>public JoinTable getJoinTable()
getJoinTable in interface JoinedMapping<Z,C,E>getJoinTable in interface AssociationMapping<Z,C,E>getJoinTable in class AssociationMappingImpl<Z,C,E>public SingularMappingEx<? super E,?> getMapKeyIdMapping()
public org.batoo.jpa.core.util.Pair<SingularMapping<?,?>,org.batoo.common.reflect.AbstractAccessor>[] getMapKeyIdMappings()
public AbstractMapping<?,?,?> getMapping(String path)
type.getMapping in interface PluralMappingEx<Z,C,E>path - the pathpublic MappingType getMappingType()
getMappingType in interface JoinedMapping<Z,C,E>public String getOrderBy()
getOrderBy in interface PluralMappingEx<Z,C,E>public OrderColumn getOrderColumn()
getOrderColumn in interface PluralMappingEx<Z,C,E>public EntityTypeImpl<E> getType()
getType in interface JoinedMapping<Z,C,E>getType in class AssociationMappingImpl<Z,C,E>public void initialize(ManagedInstance<?> instance)
initialize in interface JoinedMapping<Z,C,E>initialize in class AssociationMappingImpl<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 AssociationMappingImpl<Z,C,E>MappingException - thrown in case of a linkage errorpublic void load(ManagedInstance<?> instance)
load in interface PluralMappingEx<Z,C,E>instance - the managed instancepublic Collection<? extends E> loadCollection(ManagedInstance<?> managedInstance)
loadCollection in interface PluralMappingEx<Z,C,E>managedInstance - the managed instance owning the collectionpublic <K> Map<? extends K,? extends E> loadMap(ManagedInstance<?> instance)
loadMap in interface PluralMappingEx<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, LinkedList<ManagedInstance<?>> instances)
mergeWith in class AssociationMappingImpl<Z,C,E>entityManager - the entity managerinstance - the instanceentity - the entityrequiresFlush - if an implicit flush is requiredprocessed - registry of processed entitiesinstances - the persisted instancespublic void persistAdditions(EntityManagerImpl entityManager, ManagedInstance<?> instance)
entityManager - the entity managerinstance - the managed instancepublic boolean references(Object instance, Object reference)
references in class AssociationMappingImpl<Z,C,E>instance - the source instancereference - the associate instancepublic void refresh(ManagedInstance<?> instance, Set<Object> processed)
refresh in class AssociationMappingImpl<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 PluralMappingEx<Z,C,E>instance - the managed instancechildren - the collection of childrenpublic void setInverse(AssociationMappingImpl<?,?,?> inverse)
setInverse in class AssociationMappingImpl<Z,C,E>inverse - the inverse associationpublic void setLazy(ManagedInstance<?> instance)
setLazy in interface PluralMappingEx<Z,C,E>instance - the managed instanceCopyright © 2012 Batoo Software & Consultancy. All Rights Reserved.