Class DeleteRequest.DeleteMappingConsumer
- java.lang.Object
-
- org.datanucleus.store.rdbms.request.DeleteRequest.DeleteMappingConsumer
-
- All Implemented Interfaces:
MappingConsumer
- Enclosing class:
- DeleteRequest
private class DeleteRequest.DeleteMappingConsumer extends java.lang.Object implements MappingConsumer
Mapping Consumer used for generating the DELETE statement for an object in a table. This statement will be of the formDELETE FROM table-name WHERE id1=? AND id2=?
or (when also performing version checks)DELETE FROM table-name WHERE id1=? AND id2=? AND version={oldvers}
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<MappingCallbacks>
callbackMappings
Mapping Callbacks to invoke at deletion.private org.datanucleus.ClassLoaderResolver
clr
ClassLoaderResolverprivate org.datanucleus.metadata.AbstractClassMetaData
cmd
MetaData for the class of the object(package private) boolean
initialized
Flag for initialisation state of the consumer.private java.util.List
oneToOneNonOwnerFields
Fields in a 1-1 relation with FK in the table of the other object.(package private) int
paramIndex
Current parameter index.(package private) java.lang.StringBuilder
where
Where clause for the statement.private boolean
whereClauseConsumption
private java.util.List
whereFields
WHERE clause field numbers to use in identifying the record to delete.
-
Constructor Summary
Constructors Constructor Description DeleteMappingConsumer(org.datanucleus.ClassLoaderResolver clr, org.datanucleus.metadata.AbstractClassMetaData cmd)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
consumeMapping(JavaTypeMapping m, org.datanucleus.metadata.AbstractMemberMetaData mmd)
Consumes a mapping associated to a membervoid
consumeMapping(JavaTypeMapping m, MappingType mappingType)
Consumes a mapping for a surrogate column (version, datastore identity, multitenancy).void
consumeUnmappedColumn(Column col)
Consumer a column without mapping.java.util.List<MappingCallbacks>
getMappingCallBacks()
Obtain a List of mapping callbacks that will be run for this deletion.org.datanucleus.metadata.AbstractMemberMetaData[]
getOneToOneNonOwnerFields()
All 1-1 bidirectional non-owner fields, with the FK In the other object.java.lang.String
getSoftDeleteStatement()
java.lang.String
getStatement()
Accessor for the delete SQL statement.int[]
getWhereFieldNumbers()
Accessor for the field numbers of any WHERE clause fieldsvoid
preConsumeMapping(int highest)
This method is called before consuming the mappingsvoid
setWhereClauseConsumption()
-
-
-
Field Detail
-
initialized
boolean initialized
Flag for initialisation state of the consumer.
-
where
java.lang.StringBuilder where
Where clause for the statement. Built during the consumption process.
-
paramIndex
int paramIndex
Current parameter index.
-
whereFields
private java.util.List whereFields
WHERE clause field numbers to use in identifying the record to delete.
-
oneToOneNonOwnerFields
private java.util.List oneToOneNonOwnerFields
Fields in a 1-1 relation with FK in the table of the other object.
-
callbackMappings
private java.util.List<MappingCallbacks> callbackMappings
Mapping Callbacks to invoke at deletion.
-
clr
private final org.datanucleus.ClassLoaderResolver clr
ClassLoaderResolver
-
cmd
private final org.datanucleus.metadata.AbstractClassMetaData cmd
MetaData for the class of the object
-
whereClauseConsumption
private boolean whereClauseConsumption
-
-
Method Detail
-
setWhereClauseConsumption
public void setWhereClauseConsumption()
-
preConsumeMapping
public void preConsumeMapping(int highest)
Description copied from interface:MappingConsumer
This method is called before consuming the mappings- Specified by:
preConsumeMapping
in interfaceMappingConsumer
- Parameters:
highest
- the highest number for the fields that are going to be provided in the consumer
-
consumeMapping
public void consumeMapping(JavaTypeMapping m, org.datanucleus.metadata.AbstractMemberMetaData mmd)
Description copied from interface:MappingConsumer
Consumes a mapping associated to a member- Specified by:
consumeMapping
in interfaceMappingConsumer
- Parameters:
m
- The Java type mappingmmd
- MetaData for the member
-
consumeMapping
public void consumeMapping(JavaTypeMapping m, MappingType mappingType)
Consumes a mapping for a surrogate column (version, datastore identity, multitenancy). Never called with whereClauseConsumption=false- Specified by:
consumeMapping
in interfaceMappingConsumer
- Parameters:
m
- The mappingmappingType
- the Mapping type
-
consumeUnmappedColumn
public void consumeUnmappedColumn(Column col)
Consumer a column without mapping.- Specified by:
consumeUnmappedColumn
in interfaceMappingConsumer
- Parameters:
col
- Column
-
getWhereFieldNumbers
public int[] getWhereFieldNumbers()
Accessor for the field numbers of any WHERE clause fields- Returns:
- array of absolute WHERE clause field numbers
-
getOneToOneNonOwnerFields
public org.datanucleus.metadata.AbstractMemberMetaData[] getOneToOneNonOwnerFields()
All 1-1 bidirectional non-owner fields, with the FK In the other object.- Returns:
- The fields that are 1-1 bidirectional with the FK at the other side.
-
getMappingCallBacks
public java.util.List<MappingCallbacks> getMappingCallBacks()
Obtain a List of mapping callbacks that will be run for this deletion.- Returns:
- the mapping callbacks
-
getStatement
public java.lang.String getStatement()
Accessor for the delete SQL statement.- Returns:
- The delete SQL statement
-
getSoftDeleteStatement
public java.lang.String getSoftDeleteStatement()
-
-