|
|||||||||||
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.OneToManySetStore
The backing store for a one-to-many set defined over the class base table of its elements.
The element class has a field designated the "owner" field, which must map to a single column in its backing table. Each row having a non-null owner represents the presence of that element in the owner's Set. The owner column must be an OID column.
The base PersistenceCapable type of the owning objects in question must be
known (their ClassBaseTable
must be provided).
Queries and iterations over the set will execute with a single SQL statement that includes all the default-fetch-group fields of the elements.
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,
ClassBaseTable elementTable,
int ownerFieldNumber)
Returns a one-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, ClassBaseTable elementTable, int ownerFieldNumber)
ownerTable
- The backing table of the owner objects.elementTable
- The backing table of the element objects.ownerFieldNumber
- The absolute field number of the owner field in the element class.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 |