Z - the source typeE - the element typeC - the collection typepublic class ElementCollectionMapping<Z,C,E> extends Mapping<Z,C,E> implements PluralMapping<Z,C,E>
JoinedMapping.MappingType| Constructor and Description |
|---|
ElementCollectionMapping(ParentMapping<?,Z> parent,
PluralAttributeImpl<? super Z,C,E> attribute) |
| Modifier and Type | Method and Description |
|---|---|
void |
attach(ConnectionImpl connection,
ManagedInstance<?> instance,
Object key,
Object child,
int index)
Attaches the child.
|
boolean |
cascadesMerge()
Returns if merges are cascaded.
|
void |
detach(ConnectionImpl connection,
ManagedInstance<?> instance,
Object key,
Object child)
detaches the child.
|
void |
detachAll(ConnectionImpl connection,
ManagedInstance<?> instance)
Details all the children.
|
void |
enhance(ManagedInstance<?> instance)
Enhances the collection to the managed collection
|
Object |
extractKey(E value)
Extracts key from the value.
|
void |
flush(ConnectionImpl connection,
ManagedInstance<?> managedInstance,
boolean removals,
boolean force)
Flushes the associates.
|
PluralAttributeImpl<? super Z,C,E> |
getAttribute()
Returns the attribute of the mapping.
|
CollectionTable |
getCollectionTable()
Returns the collection table.
|
SingularMapping<? super E,?> |
getKeyMapping()
Returns the key mapping of the element collection mapping.
|
String |
getMapKey()
Returns the map key of the element collection mapping.
|
TypeImpl<?> |
getMapKeyClass()
Returns the class of the map key.
|
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.
|
JoinableTable |
getTable()
Returns the table for the relation.
|
TypeImpl<E> |
getType()
Returns the bindable entity type.
|
void |
initialize(ManagedInstance<?> instance)
Initializes the mapping.
|
boolean |
isAssociation()
Returns if the mapping is an association.
|
boolean |
isEager()
Returns if the association should be eagerly fetched.
|
boolean |
isJoined()
Returns if the mapping is a joined mapping.
|
boolean |
isMap()
Returns if the mapping is a map collection.
|
String |
join(String parentAlias,
String alias,
JoinType joinType)
Returns the join SQL for the mapping.
|
void |
link()
Links the attribute to its collection table
|
void |
load(ManagedInstance<?> instance)
Loads the collection eagerly.
|
Collection<? extends E> |
loadCollection(ManagedInstance<?> instance)
Loads and returns the collection.
|
<K> Map<? extends K,? extends E> |
loadMap(ManagedInstance<?> instance)
Loads and returns the map
|
void |
setCollection(ManagedInstance<?> instance,
Collection<? extends E> children)
Sets the collection manually for the mapping.
|
void |
setLazy(ManagedInstance<?> instance)
Sets the lazy instance for the collection
|
void |
sortList(Object instance)
Sorts the managed list of the instance
|
equals, get, getJavaType, getName, getParent, getPath, getRoot, hashCode, set, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitget, getPath, getRootpublic ElementCollectionMapping(ParentMapping<?,Z> parent, PluralAttributeImpl<? super Z,C,E> attribute)
parent - the parent mappingattribute - the attributepublic void attach(ConnectionImpl connection, ManagedInstance<?> instance, Object key, Object child, int index) throws SQLException
attach in interface PluralMapping<Z,C,E>connection - the connectioninstance - the instancekey - the key, may be nullchild - the childindex - the indexSQLException - thrown in case of an SQL errorpublic boolean cascadesMerge()
cascadesMerge in interface PluralMapping<Z,C,E>public void detach(ConnectionImpl 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(ConnectionImpl 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(E value)
extractKey in interface JoinedMapping<Z,C,E>value - the valuepublic void flush(ConnectionImpl 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 CollectionTable getCollectionTable()
public SingularMapping<? super E,?> getKeyMapping()
public String getMapKey()
public TypeImpl<?> getMapKeyClass()
getMapKeyClass in interface PluralMapping<Z,C,E>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 JoinableTable getTable()
This is, for associations the JoinTable, for element collections the CollectionTable.
getTable in interface JoinedMapping<Z,C,E>public TypeImpl<E> getType()
getType in interface JoinedMapping<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 isEager()
isEager 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 String join(String parentAlias, String alias, JoinType joinType)
join in interface JoinedMapping<Z,C,E>parentAlias - the parent table aliasalias - the primary table aliasjoinType - the join typepublic void link()
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<?> instance)
loadCollection in interface PluralMapping<Z,C,E>instance - 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 setCollection(ManagedInstance<?> instance, Collection<? extends E> children)
setCollection in interface PluralMapping<Z,C,E>instance - the managed instancechildren - the collection of childrenpublic void setLazy(ManagedInstance<?> instance)
setLazy in interface PluralMapping<Z,C,E>instance - the managed instanceCopyright © 2012 Batoo Software & Consultancy. All Rights Reserved.