Create Framework Extension Class in ADF

Create Framework Extension Class of some base classes is a good practice when you are building ADF applications. Some reasons to create Framework Extension Classes are:

  • Coding a generic functionality. For example, create a method that call Database Sequence and all Entity Objects may use it.
  • Change how a built-in feature works. For example, change the doDML() method to update a deleted flag when an Entity Row is removed (Logical Delete).
  • Workaround a bug.

A common set of customized framework base classes are:

  • public class CustomEntityImpl extends EntityImpl
  • public class CustomEntityDefImpl extends EntityDefImpl
  • public class CustomViewObjectImpl extends ViewObjectImpl
  • public class CustomViewRowImpl extends ViewRowImpl
  • public class CustomApplicationModuleImpl extends ApplicationModuleImpl
  • public class CustomDBTransactionImpl extends DBTransactionImpl2
  • public class CustomDatabaseTransactionFactoryImpl extends DatabaseTransactionFactory

You also may create the following customized framework base classes, but rarely you will override anything in these classes.

  • public class CustomViewDefImpl extends ViewDefImpl
  • public class CustomEntityCache extends EntityCache
  • public class CustomApplicationModuleDefImpl extends ApplicationModuleDefImpl

Create Framework Extension Class

Let’s change the doDML() method to update a deleted flag when an Entity Row is removed (Logical Delete). For this, we will need to create the CustomEntityImpl Framework Extension Class that extends EntityImpl.
Download the sample application:

In the Applications window, right-click the Model project and choose New > From Gallery.
In the New Gallery, choose General > Java > Class and click OK.
In the Create Java Class dialog, specify the following values and click OK.

  • Name: CustomEntityImpl
  • Package:
  • Extends: oracle.jbo.server.EntityImpl


In the CustomEntityImpl class, we will override two methods:

  • remove(): To set the deleted flag before calling the super.remove() method.
  • doDML(): To force the Entity Object to be updated instead of deleted.

Replace the content of Java class with the following code:


import oracle.jbo.server.EntityImpl;
import oracle.jbo.server.TransactionEvent;

public abstract class CustomEntityImpl extends EntityImpl {
  public void remove() {

  protected void doDML(int operation, TransactionEvent transactionEvent) {
    if (operation == DML_DELETE) {
      operation = DML_UPDATE;
    super.doDML(operation, transactionEvent);

  public abstract void setDeleted(String value);


Add a new DELETED column to the COUNTRIES table.


It is necessary to syncronize the Countries Entity Object with Database.
In the Applications window, right-click the Countries Entity Object and choose Syncronize with Database.
Click the Syncronize All button, and then click Yes.


To implement the setDeleted() method, we will need to generate the CountriesImpl class.
In the Applications window, and double-click the Countries Entity Object.
Click the Java navigation tab and then click the Edit Java Classes button.
In the Select Java Options dialog, select these options: Generate Entity Object Class and Accessors.


Click the Classes Extend button.
In the Override Base Classes dialog, replace the content of Row field:


As you can see, the setDeleted() method was created.


Just like that!
Now, if you run the Oracle ADF Model Tester and delete any country, the DELETED column is updated.




You may change the preferences and define the Framework Extension Classes for all New Components.
These preferences do not affect any existing components in the project.