Thursday 12 December 2019

oracle.jbo.DeadEntityAccessException: JBO-27101. Resolved! Attempt to access a dead Entity in EntityObject.


Error : oracle.jbo.DeadEntityAccessException: JBO-27101

Description: Attempt to access a dead entity in the Entity Object.

Root cause: This issue comes up when the application is trying to access a row that is already removed from the entity object cache. Suppose a row is being deleted in a method and then at the end, the same row is being referenced for doing some kind of operation.
 
The error normally comes up due to wrong implementation logic written in

public void doDML(int operation, TransactionEvent e)

method of EntityImpl class. This method runs after every DML operation in the row.
On removing the row also, this method will be called and if some logic is written there such as updating some attribute values of that row without checking for the transaction type, then this error may come up.

Here is an example of the wrong implementation:

    protected void doDML(int operation, TransactionEvent e) {
        super.doDML(operation, e);
        setModifiedOnDt(new Date());   
    }

Right Implementation:

    protected void doDML(int operation, TransactionEvent e) {
        super.doDML(operation, e);
        if(operation == DML_UPDATE){
            setModifiedOnDt(new Date());   
        }
    }

If the above is not your use case, then here is another example

Another example just to simulate this error:

    public void updateRecord(){
        Row currentRow = getEmployeeVO1().getCurrentRow();
        currentRow.remove();
        // oracle.jbo.DeadEntityAccessException: JBO-27101 Error will be shown in the code below
        Object empId = currentRow.getAttribute("EmployeeId");
    }
 
Solution:
The solution is to ensure that if any row is deleted then it should not be referenced after the deletion.

Next: What is the use of EntityImpl in ADF??

No comments:

Post a Comment