|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpox.store.rdbms.scostore.BaseContainerStore
org.jpox.store.rdbms.scostore.ElementContainerStore
org.jpox.store.rdbms.scostore.AbstractCollectionStore
org.jpox.store.rdbms.scostore.AbstractSetStore
org.jpox.store.rdbms.scostore.JoinSetStore
Representation of a Normal 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 InverseSetStore which represents 1-N relationships without using a link table (using an id in the other table).
For sets of primitive types (eg Date,String etc), the NormalSetStore is used, but the 'link' table contains the id of the owner and the field(s) representing the primitive type.
Nested Class Summary |
Nested classes inherited from class org.jpox.store.rdbms.scostore.ElementContainerStore |
ElementContainerStore.ElementInfo |
Field Summary | |
protected java.lang.String |
addStmt
|
protected java.lang.String |
locateStmt
Statement to check the existence of an owner-element relation. |
protected boolean |
m2n
Whether this relation is one end of an M-N relation. |
protected java.lang.String |
maxOrderColumnIdStmt
Statement to get the maximum order column id so we can set the next insert value. |
protected java.lang.String |
removeStmt
|
protected java.lang.String |
setName
|
Fields inherited from class org.jpox.store.rdbms.scostore.AbstractCollectionStore |
containsStmt |
Fields inherited from class org.jpox.store.rdbms.scostore.ElementContainerStore |
clearStmt, clr, containerTable, dba, elementInfo, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, elmIdentifier, emd, iterateUsingDiscriminator, LOCALISER, orderMapping, ownerFieldMetaData, ownerMapping, relationDiscriminatorMapping, relationDiscriminatorValue, sizeStmt, storeMgr, thisIdentifier |
Constructor Summary | |
JoinSetStore(AbstractPropertyMetaData fmd,
CollectionTable joinTable,
ClassLoaderResolver clr)
Constructor for the relationship representation. |
Method Summary | |
boolean |
add(StateManager sm,
java.lang.Object element)
Adds one element to the association owner vs elements. |
boolean |
addAll(StateManager sm,
java.util.Collection elements)
Adds all elements from a collection to the association container. |
protected QueryExpression |
getIteratorStatement(StateManager ownerSM)
Accessor for the statement for the iterator. |
protected java.lang.String |
getRemoveAllStmt(StateManager ownerSm,
java.util.Collection elements)
Generate statement for removing a collection of items from the Set. |
protected java.lang.String |
getRemoveStmt()
Generate statement for deleting items from the Set. |
protected void |
initialiseStatements()
Method to initialise the statements being used. |
java.util.Iterator |
iterator(StateManager ownerSM)
Accessor for an iterator for the set. |
ScalarExpression |
joinElementsTo(QueryExpression stmt,
QueryExpression parentStmt,
JavaTypeMapping ownerMapping,
LogicSetExpression ownerTe,
DatastoreIdentifier setRangeVar,
java.lang.Class filteredElementType,
ScalarExpression elmExpr,
DatastoreIdentifier elementRangeVar)
Utility for use in building a query, joining the element table and the owner table. |
boolean |
locate(StateManager sm,
java.lang.Object element)
Method to check for the existence in the datastore of an owner-element relation. |
QueryExpression |
newQueryStatement(StateManager sm,
java.lang.String candidateClass)
Utility method to return a new QueryStatement for retrieval of the elements of this Set. |
boolean |
remove(StateManager sm,
java.lang.Object element)
Removes the association to one element |
boolean |
removeAll(StateManager sm,
java.util.Collection elements)
Remove all elements from a collection from the association owner vs elements. |
Methods inherited from class org.jpox.store.rdbms.scostore.AbstractCollectionStore |
contains, getContainsStmt, getExistsSubquery, getSizeSubquery, getUpdateEmbeddedElementStmt, updateEmbeddedElement |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jpox.store.scostore.CollectionStore |
clear, contains, getElementType, getExistsSubquery, getSizeSubquery, hasOrderMapping, newResultObjectFactory, size, updateEmbeddedElement |
Methods inherited from interface org.jpox.store.scostore.Store |
getOwnerMapping, getStoreManager |
Field Detail |
protected final java.lang.String locateStmt
protected final java.lang.String maxOrderColumnIdStmt
protected final boolean m2n
protected java.lang.String setName
protected java.lang.String addStmt
protected java.lang.String removeStmt
Constructor Detail |
public JoinSetStore(AbstractPropertyMetaData fmd, CollectionTable joinTable, ClassLoaderResolver clr)
joinTable
- The table for the linkclr
- The ClassLoaderResolverMethod Detail |
protected java.lang.String getRemoveStmt()
DELETE FROM SETTABLE WHERE OWNERCOL=? AND ELEMENTCOL = ? [AND EMBEDDEDFIELD1 = ? AND EMBEDDEDFIELD2 = ? AND EMBEDDEDFIELD3 = ?] [AND RELATION_DISCRIM = ?]
protected java.lang.String getRemoveAllStmt(StateManager ownerSm, java.util.Collection elements)
DELETE FROM SETTABLE WHERE (OWNERCOL=? AND ELEMENTCOL=?) OR (OWNERCOL=? AND ELEMENTCOL=?) OR (OWNERCOL=? AND ELEMENTCOL=?)
ownerSm
- The owner StateManagerelements
- Collection of elements to remove
public boolean removeAll(StateManager sm, java.util.Collection elements)
sm
- State Manager for the containerelements
- Collection of elements to remove
public boolean locate(StateManager sm, java.lang.Object element)
sm
- State Manager for the ownerelement
- The element
public boolean add(StateManager sm, java.lang.Object element)
sm
- State Manager for the container.element
- Element to add
public boolean addAll(StateManager sm, java.util.Collection elements)
sm
- State Manager for the container.elements
- Collection of elements to add
protected QueryExpression getIteratorStatement(StateManager ownerSM)
ownerSM
- the owner StateManager
public QueryExpression newQueryStatement(StateManager sm, java.lang.String candidateClass)
sm
- StateManager for this objectcandidateClass
- Class for the element end of the link.
public ScalarExpression joinElementsTo(QueryExpression stmt, QueryExpression parentStmt, JavaTypeMapping ownerMapping, LogicSetExpression ownerTe, DatastoreIdentifier setRangeVar, java.lang.Class filteredElementType, ScalarExpression elmExpr, DatastoreIdentifier elementRangeVar)
stmt
- The Query StatementparentStmt
- the parent Query Statement. If there is no parent, parentStmt
must be equals to stmt
ownerMapping
- the mapping for the owner.ownerTe
- Table Expression for the ownersetRangeVar
- The range variable for the "Set" table.filteredElementType
- The Class Type for the filtered elementelmExpr
- The Expression for the elementelementRangeVar
- The SQL alias, or "range variable", to assign to the
expression or to the element table.
protected void initialiseStatements()
initialiseStatements
in class AbstractCollectionStore
public java.util.Iterator iterator(StateManager ownerSM)
iterator
in interface CollectionStore
iterator
in class ElementContainerStore
ownerSM
- State Manager for the set.
public boolean remove(StateManager sm, java.lang.Object element)
remove
in interface CollectionStore
sm
- State Manager for the containerelement
- Element to remove
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |