Retrieving deleted Entity Objects
I have seen a couple of use cases where developers need to iterate through the deleted Entity Objects and perform validations based on various conditions. Steve shared some pointers, which helped me to find a solution. The following code snippet may help you to identify the deleted entities. public class EmployeesImpl extends EntityImpl { public ArrayList<EntityImpl> findDeletedEmployees() { ArrayList<EntityImpl> deletedList = new ArrayList<EntityImpl>(); Iterator iterator = this.getEntityDef(). getAllEntityInstancesIterator (this.getDBTransaction()); while (iterator.hasNext()) { EmployeesImpl emp = (EmployeesImpl)iterator.next(); if (emp.getEntityState() == Entity.STATUS_DELETED) { // Keep soft ref. if worried on GC deletedList.add(emp); } } return deletedList; } // Rest ...