org.datanucleus.store.mapped.scostore
Class JoinSetStore
java.lang.Object
org.datanucleus.store.mapped.scostore.BaseContainerStore
org.datanucleus.store.mapped.scostore.ElementContainerStore
org.datanucleus.store.mapped.scostore.AbstractCollectionStore
org.datanucleus.store.mapped.scostore.AbstractSetStore
org.datanucleus.store.mapped.scostore.JoinSetStore
- All Implemented Interfaces:
- CollectionStore, SetStore, Store
public abstract class JoinSetStore
- extends AbstractSetStore
Representation of a JoinTable Set as part of a relationship. This class is
used where you have a 1-N and the tables are joined via a link table.
That is one table is the owner, and it has a link table to another table,
with the link table having 2 columns - the ids of the 2 tables.
This is in contrast to FKSetStore which represents 1-N relationships
without using a link table (using an id in the other table).
For sets of primitive types (e.g Date,String etc), the JoinSetStore is used,
but the 'link' table contains the id of the owner and the field(s)
representing the primitive type.
| Fields inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore |
clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, specialization |
|
Constructor Summary |
JoinSetStore(AbstractMemberMetaData mmd,
DatastoreContainerObject joinTable,
ClassLoaderResolver clr,
JavaTypeMapping ownerMapping,
JavaTypeMapping elementMapping,
JavaTypeMapping orderMapping,
JavaTypeMapping relationDiscriminatorMapping,
java.lang.String relationDiscriminatorValue,
boolean isEmbeddedElement,
boolean isSerialisedElement,
AbstractSetStoreSpecialization specialization)
Constructor for the relationship representation. |
|
Method Summary |
boolean |
add(ObjectProvider sm,
java.lang.Object element,
int size)
Adds one element to the association owner vs elements. |
boolean |
addAll(ObjectProvider sm,
java.util.Collection elements,
int size)
Adds all elements from a collection to the association container. |
protected abstract int[] |
doInternalAdd(ObjectProvider sm,
java.lang.Object element,
ManagedConnection conn,
boolean batched,
int orderId,
boolean executeNow)
|
protected abstract int |
getNextIDForOrderColumn(ObjectProvider sm)
Accessor for the next id when elements primary key can't be part of the primary key by datastore limitations like
BLOB types can't be primary keys. |
abstract boolean |
locate(ObjectProvider sm,
java.lang.Object element)
Method to check for the existence in the datastore of an owner-element relation. |
protected abstract void |
preGetNextIDForOrderColumn(ManagedConnection mconn)
|
boolean |
removeAll(ObjectProvider sm,
java.util.Collection elements,
int size)
Remove all elements from a collection from the association owner vs elements. |
protected abstract boolean |
removeAllInternal(ObjectProvider sm,
java.util.Collection elements,
int size)
|
void |
update(ObjectProvider sm,
java.util.Collection coll)
Method to update the collection to be the supplied collection of elements. |
| Methods inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore |
clear, getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getElementType, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, hasOrderMapping, isElementsAreEmbedded, isElementsAreSerialised, size, validateElementForReading, validateElementForWriting, validateElementType |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JoinSetStore
public JoinSetStore(AbstractMemberMetaData mmd,
DatastoreContainerObject joinTable,
ClassLoaderResolver clr,
JavaTypeMapping ownerMapping,
JavaTypeMapping elementMapping,
JavaTypeMapping orderMapping,
JavaTypeMapping relationDiscriminatorMapping,
java.lang.String relationDiscriminatorValue,
boolean isEmbeddedElement,
boolean isSerialisedElement,
AbstractSetStoreSpecialization specialization)
- Constructor for the relationship representation.
- Parameters:
mmd - Metadata for the owner memberjoinTable - The table for the linkclr - The ClassLoaderResolver
update
public void update(ObjectProvider sm,
java.util.Collection coll)
- Method to update the collection to be the supplied collection of elements.
- Specified by:
update in interface CollectionStore- Overrides:
update in class AbstractCollectionStore
- Parameters:
sm - StateManager of the objectcoll - The collection to use
removeAll
public boolean removeAll(ObjectProvider sm,
java.util.Collection elements,
int size)
- Remove all elements from a collection from the association owner vs elements.
- Specified by:
removeAll in interface CollectionStore- Overrides:
removeAll in class AbstractSetStore
- Parameters:
sm - State Manager for the containerelements - Collection of elements to removesize - Current size of collection if known. -1 if not known
- Returns:
- Whether the database was updated
removeAllInternal
protected abstract boolean removeAllInternal(ObjectProvider sm,
java.util.Collection elements,
int size)
locate
public abstract boolean locate(ObjectProvider sm,
java.lang.Object element)
- Method to check for the existence in the datastore of an owner-element relation.
- Parameters:
sm - State Manager for the ownerelement - The element
- Returns:
- Whether the relation exists in the datastore
add
public boolean add(ObjectProvider sm,
java.lang.Object element,
int size)
- Adds one element to the association owner vs elements.
- Specified by:
add in interface CollectionStore- Overrides:
add in class AbstractSetStore
- Parameters:
sm - State Manager for the container.element - Element to addsize - Current size of the collection if known. -1 if not known
- Returns:
- Whether it was successful
addAll
public boolean addAll(ObjectProvider sm,
java.util.Collection elements,
int size)
- Adds all elements from a collection to the association container.
- Specified by:
addAll in interface CollectionStore- Overrides:
addAll in class AbstractSetStore
- Parameters:
sm - State Manager for the container.elements - Collection of elements to addsize - Current size of set (if known). Not used by sets
- Returns:
- Whether it was successful
preGetNextIDForOrderColumn
protected abstract void preGetNextIDForOrderColumn(ManagedConnection mconn)
throws MappedDatastoreException
- Throws:
MappedDatastoreException
doInternalAdd
protected abstract int[] doInternalAdd(ObjectProvider sm,
java.lang.Object element,
ManagedConnection conn,
boolean batched,
int orderId,
boolean executeNow)
throws MappedDatastoreException
- Throws:
MappedDatastoreException
getNextIDForOrderColumn
protected abstract int getNextIDForOrderColumn(ObjectProvider sm)
throws MappedDatastoreException
- Accessor for the next id when elements primary key can't be part of the primary key by datastore limitations like
BLOB types can't be primary keys. Also for where the user wants to allow duplicates.
- Parameters:
sm - The State Manager
- Returns:
- the next id value
- Throws:
MappedDatastoreException
Copyright © 2011. All Rights Reserved.