|
|||||||||||
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.FKSetStore
Representation of an Inverse Set as part of a relationship. This class is used where you have a 1-N and the tables are not joined via a link table. That is there is an owner table, and a collection table, and the collection table has a column being the id of the owner table. This is in contrast to NormalSetStore which represents 1-N relationships using a link table. There are 2 possible uses here
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 |
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 | |
FKSetStore(AbstractPropertyMetaData fmd,
RDBMSManager storeMgr,
ClassLoaderResolver clr)
Constructor for the relationship representation. |
Method Summary | |
boolean |
add(StateManager sm,
java.lang.Object element)
Method to add an object to the relationship at the collection end. |
boolean |
addAll(StateManager sm,
java.util.Collection elements)
Method to add a collection of object to the relationship at the collection end. |
void |
clear(StateManager ownerSM)
Method to allow the Set relationship to be cleared out. |
protected java.lang.String |
getClearNullifyStmt()
Generates the statement for clearing items by nulling the owner link out. |
protected java.lang.String |
getContainsStmt()
Generate statement for retrieving the contents of the Collection. |
protected QueryExpression |
getIteratorStatement(StateManager ownerSM)
Accessor for a QueryStatement to retrieve the elements of the set. |
protected int |
getOwnerFieldOwner(StateManager sm)
|
protected java.lang.String |
getRemoveStmt()
Generate statement for deleting an item from the Set. |
protected java.lang.String |
getSizeStmt()
Generate statement for getting the size of the container. |
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. |
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)
Method to remove the link to the collection object specified. |
boolean |
removeAll(StateManager sm,
java.util.Collection elements)
Method to remove the links to a collection of elements specified. |
protected void |
validateElementForWriting(StateManager sm,
java.lang.Object element)
Method to check if an element is already persistent, or is managed by a different Persistencemanager. |
Methods inherited from class org.jpox.store.rdbms.scostore.AbstractCollectionStore |
contains, 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 |
contains, getElementType, getExistsSubquery, getSizeSubquery, hasOrderMapping, newResultObjectFactory, size, updateEmbeddedElement |
Methods inherited from interface org.jpox.store.scostore.Store |
getOwnerMapping, getStoreManager |
Field Detail |
protected java.lang.String setName
protected java.lang.String addStmt
protected java.lang.String removeStmt
Constructor Detail |
public FKSetStore(AbstractPropertyMetaData fmd, RDBMSManager storeMgr, ClassLoaderResolver clr)
fmd
- The MetaData for the field that this representsstoreMgr
- The RDBMSManager managing the associated datastore.clr
- The ClassLoaderResolverMethod Detail |
protected java.lang.String getSizeStmt()
SELECT COUNT(*) FROM CONTAINERTABLE WHERE OWNERCOL=? [AND ORDERCOL IS NOT NULL] [AND (DISCRIMINATOR=? OR DISCRMINATOR=? OR DISCRIMINATOR=?)]The discriminator part includes all subclasses of the element type
getSizeStmt
in class ElementContainerStore
protected java.lang.String getContainsStmt()
SELECT OWNERCOL FROM COLLECTIONTABLE WHERE OWNERCOL=? AND ELEMENTCOL = ? [AND DISCRIMINATOR = ?]
getContainsStmt
in class AbstractCollectionStore
protected java.lang.String getClearNullifyStmt()
UPDATE LISTTABLE SET OWNERCOL=NULL [,DISTINGUISHER=NULL] WHERE OWNERCOL=?when there is only one element table, and will be
UPDATE ? SET OWNERCOL=NULL [,DISTINGUISHER=NULL] WHERE OWNERCOL=?when there is more than 1 element table.
protected void validateElementForWriting(StateManager sm, java.lang.Object element)
validateElementForWriting
in class ElementContainerStore
sm
- The state manager of this collectionelement
- The elementprotected int getOwnerFieldOwner(StateManager sm)
public boolean add(StateManager sm, java.lang.Object element)
sm
- StateManager of the owner of the Setelement
- Element to be added
public boolean addAll(StateManager sm, java.util.Collection elements)
sm
- StateManager of the Setelements
- Elements to be added
public boolean remove(StateManager sm, java.lang.Object element)
sm
- The StateManager of the Setelement
- The element of the collection to be deleted.
public boolean removeAll(StateManager sm, java.util.Collection elements)
sm
- The StateManager of the Setelements
- The elements of the collection to be deleted.
public void clear(StateManager ownerSM)
clear
in interface CollectionStore
clear
in class ElementContainerStore
ownerSM
- StateManager of the Setprotected 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.
protected java.lang.String getRemoveStmt()
DELETE FROM SETTABLE WHERE OWNERCOL=? AND ELEMENTCOL = ? [AND DISCRIM = ?]
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |