public class DeleteRelatedEntitiesJPATransformer extends Object implements org.apache.commons.collections.Transformer
Transformer
provides a visitor via injection to the core logic, that can allow manipulating the number of entities that are effected in a delete operation.
transform(Object)
Modifier and Type | Field and Description |
---|---|
protected javax.persistence.EntityManager |
entityManager |
protected String |
entityName
Name of the core entity to which all the other records/entities are related
|
protected boolean |
isNative
Is the Query and related entities native.
This should be ideally set by an overriding class based on the types of relatedEntities it sets. |
protected String[][] |
relatedEntities
A 2D Array of entity (table) and the field that is related to Core entity (Product).
Array[0]=entity name, Array[1]=Related Field name in the related entityy Optionally: One can add Array[2]=update clause on Delete Operations to support logical delete. Example: field_1='xyz' Used while operations like Delete where Cascade may not be enforced and Ref.Integrity is valid. |
Constructor and Description |
---|
DeleteRelatedEntitiesJPATransformer() |
DeleteRelatedEntitiesJPATransformer(String[][] relatedEntities,
String entityName) |
Modifier and Type | Method and Description |
---|---|
protected void |
deleteBasedOnHierarchy(Object input,
String relatedEntityName,
String relatedFieldName) |
javax.persistence.EntityManager |
getEntityManager() |
String |
getEntityName()
Name of the core entity to which all the other records/entities are related
|
String[][] |
getRelatedEntities()
A 2D Array of entity (table) and the field that is related to Core entity (Product).
Array[0]=entity name, Array[1]=Related Field name in the related entityy Optionally: One can add Array[2]=update clause on Delete Operations to support logical delete. Example: field_1='xyz' Used while operations like Delete where Cascade may not be enforced and Ref.Integrity is valid. |
void |
setEntityManager(javax.persistence.EntityManager entityManager) |
void |
setEntityName(String entityName)
Name of the core entity to which all the other records/entities are related
|
void |
setRelatedEntities(String[][] relatedEntities)
A 2D Array of entity (table) and the field that is related to Core entity (Product).
Array[0]=entity name, Array[1]=Related Field name in the related entityy Optionally: One can add Array[2]=update clause on Delete Operations to support logical delete. Example: field_1='xyz' Used while operations like Delete where Cascade may not be enforced and Ref.Integrity is valid. |
Object |
transform(Object input)
For various types of input run the query
|
protected transient javax.persistence.EntityManager entityManager
protected String[][] relatedEntities
Metamodel
. By default this is specified.protected String entityName
protected boolean isNative
relatedEntities
it sets.@Transactional(readOnly=false) public Object transform(Object input)
transform
in interface org.apache.commons.collections.Transformer
@Transactional(readOnly=false) protected void deleteBasedOnHierarchy(Object input, String relatedEntityName, String relatedFieldName)
public javax.persistence.EntityManager getEntityManager()
public void setEntityManager(javax.persistence.EntityManager entityManager)
public String[][] getRelatedEntities()
Metamodel
. By default this is specified.public void setRelatedEntities(String[][] relatedEntities)
Metamodel
. By default this is specified.public String getEntityName()
public void setEntityName(String entityName)
Copyright © 2018. All rights reserved.