|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.triactive.jdo.store.AbstractSetStore com.triactive.jdo.store.ManyToManySetStore
The backing store for a many-to-many set defined over a join table.
The join table has (at least) two columns, designated the "owner" and "element" columns. Each {owner,element} pair represents the presence of that element in the the owner's Set. The owner column must be an OID column. The element column may or may not be an OID.
The base PersistenceCapable type of the owning objects in question must be
known (their ClassBaseTable
must be provided).
If the elements are PersistenceCapable then queries and iterations over the set will execute with a single SQL statement that includes all the default-fetch-group fields.
Field Summary | |
protected DatabaseAdapter |
dba
The database adapter for this set store. |
Method Summary | |
boolean |
allowsNulls()
Indicates whether or not null elements are allowed to be stored. |
void |
clearAll(java.util.Collection owners)
Clears the sets associated with an entire group of objects. |
boolean |
equals(java.lang.Object obj)
|
java.lang.Class |
getElementType()
Returns the type of elements stored in the collection. |
static SetStore |
getInstance(ClassBaseTable ownerTable,
Table joinTable,
ColumnMapping ownerMapping,
ColumnMapping elementMapping)
Returns a many-to-many set store. |
int |
hashCode()
|
protected com.triactive.jdo.store.AbstractSetStore |
intern()
|
boolean |
isEmbeddedElement()
Indicates whether or not elements are "embedded" in the store. An embedded object is stored by value (SCO), otherwise an OID reference is stored (FCO). |
PersistentSet |
newSetInstance(StateManager owner)
Returns a new persistent set representing the set associated with the given object. Iterators returned by the persistent set support the remove() method. |
QueryStatement.QueryColumn[] |
newSubqueryStatement(QueryStatement qs,
CorrelationName setRangeVar)
Creates a subquery of the given query that selects all the relationships in the collection. No columns have been selected yet in the new subquery. |
QueryStatement.QueryColumn[] |
newSubqueryStatement(QueryStatement qs,
CorrelationName setRangeVar,
CorrelationName elementRangeVar,
java.lang.Class elementSubtype)
Creates a subquery of the given query that selects all the relationships in the collection to elements of a specific type. No columns have been selected yet in the new subquery. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final DatabaseAdapter dba
Method Detail |
public static SetStore getInstance(ClassBaseTable ownerTable, Table joinTable, ColumnMapping ownerMapping, ColumnMapping elementMapping)
ownerTable
- The backing table of the owner objects.joinTable
- The table joining owners to elements.ownerMapping
- The mapping for the owner column in the join table.elementMapping
- The mapping for the element column in the join table.public java.lang.Class getElementType()
public boolean isEmbeddedElement()
public boolean allowsNulls()
public QueryStatement.QueryColumn[] newSubqueryStatement(QueryStatement qs, CorrelationName setRangeVar)
qs
- The surrounding query statement.setRangeVar
- The range variable to be used for the "Set" table in the subquery.
public QueryStatement.QueryColumn[] newSubqueryStatement(QueryStatement qs, CorrelationName setRangeVar, CorrelationName elementRangeVar, java.lang.Class elementSubtype)
qs
- The surrounding query statement.setRangeVar
- The range variable to be used for the "Set" table in the subquery.elementRangeVar
- The range variable to be used for the "Element" table in the
subquery, if necessary.elementSubtype
- Attempts to query only over elements of this type.
public PersistentSet newSetInstance(StateManager owner)
Iterators returned by the persistent set support the remove() method.
owner
- The StateManager of the object whose set is to be returned.
public int hashCode()
public boolean equals(java.lang.Object obj)
protected com.triactive.jdo.store.AbstractSetStore intern()
public void clearAll(java.util.Collection owners)
The implementation in this class simply iterates over the owners,
and calls newSetInstance(o).clear()
on each one.
There are opportunities for further optimization here.
Subclasses might benefit from implementing this method in some way more
specific to the type of SetStore.
For many-to-many sets, the clearing of the rows in the join table could be made quicker by a series of DELETE ... WHERE OWNER IN (?,...)
For one-to-many sets, if the owner column is nullable a series of UPDATE ... SET OWNER = NULL WHERE OWNER IN (?,...) might be faster. If it's not nullable then the deletions might be made quicker with a new method like ClassBaseTable.deleteWhereIn().
Another day ...
clearAll
in interface SetStore
owners
- The StateManagers of all the objects whose set is to be cleared.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |