|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.mapped.scostore.BaseElementContainerStoreSpecialization
org.datanucleus.store.rdbms.scostore.RDBMSFKArrayStoreSpecialization
public class RDBMSFKArrayStoreSpecialization
RDBMS-specific implementation of an FKArrayStoreSpecialization.
| Field Summary | |
|---|---|
protected java.lang.String |
addStmt
Statement for adding an element to the container. |
protected java.lang.String |
clearStmt
Statement for clearing the container. |
protected java.lang.String |
removeStmt
Statement for removing an element from the container. |
protected java.lang.String |
sizeStmt
Statement for getting the size of the container. |
protected RDBMSManager |
storeMgr
|
protected boolean |
usingDiscriminatorInSizeStmt
Whether we are using a discriminator in the "size" statement. |
| Fields inherited from class org.datanucleus.store.mapped.scostore.BaseElementContainerStoreSpecialization |
|---|
clr, localiser |
| Method Summary | |
|---|---|
void |
clear(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Method to clear the array (nulls out all FKs to this owner). |
boolean |
contains(org.datanucleus.StateManager sm,
java.lang.Object element,
org.datanucleus.store.mapped.scostore.AbstractCollectionStore acs)
|
void |
executeClear(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
protected java.lang.String |
getAddStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generates the statement for adding items. |
protected java.lang.String |
getClearNullifyStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generates the statement for clearing items by nulling the owner link out. |
protected java.lang.String |
getClearStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generate statement for clearing the container. |
protected java.lang.String |
getRemoveStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generate statement for removing an element from the Collection. |
int |
getSize(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
protected java.lang.String |
getSizeStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Generate statement for getting the size of thecontainer. |
boolean |
getUpdateElementFk(org.datanucleus.StateManager ownerSM,
java.lang.Object element,
java.lang.Object owner,
int index,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Method to update the element FK to point to the specified owner/index. |
protected java.lang.String |
getUpdateEmbeddedElementStmt(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
org.datanucleus.store.mapped.scostore.ElementContainerStore acs)
Generate statement for update the field of an embedded element. |
int[] |
internalAdd(org.datanucleus.StateManager sm,
org.datanucleus.store.mapped.scostore.AbstractArrayStore aas,
java.lang.Object element,
org.datanucleus.ManagedConnection conn,
boolean batched,
int orderId,
boolean executeNow)
Internal method to add a row to the join table. |
int[] |
internalRemove(org.datanucleus.StateManager ownerSM,
org.datanucleus.ManagedConnection conn,
boolean batched,
java.lang.Object element,
boolean executeNow,
org.datanucleus.store.mapped.scostore.AbstractCollectionStore acs)
|
protected void |
invalidateAddStmt()
Method to remove any stored statement for addition of an element. |
void |
processBatchedWrites(org.datanucleus.ManagedConnection mconn)
|
boolean |
updateEmbeddedElement(org.datanucleus.StateManager sm,
java.lang.Object element,
int fieldNumber,
java.lang.Object value,
org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.datanucleus.store.mapped.scostore.AbstractArrayStoreSpecialization |
|---|
internalAdd, processBatchedWrites |
| Methods inherited from interface org.datanucleus.store.mapped.scostore.AbstractCollectionStoreSpecialization |
|---|
contains, internalRemove, updateEmbeddedElement |
| Methods inherited from interface org.datanucleus.store.mapped.scostore.ElementContainerStoreSpecialization |
|---|
executeClear, getSize |
| Field Detail |
|---|
protected final RDBMSManager storeMgr
protected java.lang.String sizeStmt
protected java.lang.String clearStmt
protected java.lang.String addStmt
protected java.lang.String removeStmt
protected boolean usingDiscriminatorInSizeStmt
| Method Detail |
|---|
public boolean getUpdateElementFk(org.datanucleus.StateManager ownerSM,
java.lang.Object element,
java.lang.Object owner,
int index,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
getUpdateElementFk in interface org.datanucleus.store.mapped.scostore.FKArrayStoreSpecializationownerSM - StateManager of the ownerelement - The element objectowner - The owner we should set the FK to (can be null)index - Position in the listecs - backing store
public void clear(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
clear in interface org.datanucleus.store.mapped.scostore.AbstractArrayStoreSpecializationclear in interface org.datanucleus.store.mapped.scostore.FKArrayStoreSpecializationownerSM - StateManager for the ownerecs - Backing storeprotected java.lang.String getClearNullifyStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
UPDATE ARRAYTABLE SET OWNERCOL=NULL, INDEXCOL=NULL [,DISTINGUISHER=NULL] WHERE OWNERCOL=? [AND DISTINGUISHER=?]when there is only one element table, and will be
UPDATE ? SET OWNERCOL=NULL, INDEXCOL=NULL [,DISTINGUISHER=NULL] WHERE OWNERCOL=? [AND DISTINGUISHER=?]when there is more than 1 element table.
public int[] internalAdd(org.datanucleus.StateManager sm,
org.datanucleus.store.mapped.scostore.AbstractArrayStore aas,
java.lang.Object element,
org.datanucleus.ManagedConnection conn,
boolean batched,
int orderId,
boolean executeNow)
throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
internalAdd in interface org.datanucleus.store.mapped.scostore.AbstractArrayStoreSpecializationsm - StateManager for the owner of the collectionelement - The element to add the relation toconn - The connectionbatched - Whether we are batchingorderId - The order id to use for this element relationexecuteNow - Whether to execute the statement now (and not wait for any batch)
java.sql.SQLException - Thrown if an error occurs
org.datanucleus.store.mapped.exceptions.MappedDatastoreException
public void processBatchedWrites(org.datanucleus.ManagedConnection mconn)
throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
processBatchedWrites in interface org.datanucleus.store.mapped.scostore.AbstractArrayStoreSpecializationorg.datanucleus.store.mapped.exceptions.MappedDatastoreException
protected java.lang.String getUpdateEmbeddedElementStmt(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
org.datanucleus.store.mapped.scostore.ElementContainerStore acs)
UPDATE SETTABLE SET EMBEDDEDFIELD1 = ? WHERE OWNERCOL=? AND ELEMENTCOL = ?
fieldMapping - The mapping for the field within the embedded object to be updated
public boolean updateEmbeddedElement(org.datanucleus.StateManager sm,
java.lang.Object element,
int fieldNumber,
java.lang.Object value,
org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
updateEmbeddedElement in interface org.datanucleus.store.mapped.scostore.AbstractCollectionStoreSpecialization
public boolean contains(org.datanucleus.StateManager sm,
java.lang.Object element,
org.datanucleus.store.mapped.scostore.AbstractCollectionStore acs)
contains in interface org.datanucleus.store.mapped.scostore.AbstractCollectionStoreSpecialization
public int[] internalRemove(org.datanucleus.StateManager ownerSM,
org.datanucleus.ManagedConnection conn,
boolean batched,
java.lang.Object element,
boolean executeNow,
org.datanucleus.store.mapped.scostore.AbstractCollectionStore acs)
throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
internalRemove in interface org.datanucleus.store.mapped.scostore.AbstractCollectionStoreSpecializationorg.datanucleus.store.mapped.exceptions.MappedDatastoreExceptionprotected java.lang.String getRemoveStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
DELETE FROM COLLTABLE WHERE OWNERCOL=? AND ELEMENTCOL = ? [AND DISCRIM = ?]
ecs - Element container store
protected void invalidateAddStmt()
protected java.lang.String getAddStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
INSERT INTO COLLTABLE (OWNERCOL,[ELEMENTCOL],[EMBEDDEDFIELD1, EMBEDDEDFIELD2,...],[ORDERCOL])
VALUES (?,?,?)
public void executeClear(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
protected java.lang.String getClearStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
DELETE FROM CONTAINERTABLE WHERE OWNERCOL = ? [AND RELATION_DISCRIM=?]TODO Add a discriminator restriction on this statement so we only clear ones with a valid discriminator value
public int getSize(org.datanucleus.StateManager ownerSM,
org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
protected java.lang.String getSizeStmt(org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
SELECT COUNT(*) FROM TBL THIS [INNER JOIN ELEM_TBL ELEM ON TBL.COL = ELEM.ID] - when no null [LEFT OUTER JOIN ELEM_TBL ELEM ON TBL.COL = ELEM.ID] - when allows null WHERE THIS.OWNERCOL=? [AND THIS.ORDERCOL IS NOT NULL] [AND (DISCRIMINATOR=? OR DISCRMINATOR=? OR DISCRIMINATOR=? [OR DISCRIMINATOR IS NULL])] [AND RELATION_DISCRIM=?]The discriminator part includes all subclasses of the element type. If the element is in a different table to the container then an INNER JOIN will be present to link the two tables, and table aliases will be present also. TODO Update this to allow for getting the size when more than 1 element table.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||