Oracle ADF Best Practices, Mistakes and Worst Practices

Sharing is Caring

In this post I am putting some practices and that we should follow while using Oracle Application Development Framework for development

  • Configure resource bundle before creating business components
    Using external XML file as list resource bundle in ADF Application
  • Avoid code duplication, Use utility classes instead – ADFUtil, JSFUtil etc
    ADF and JSF Utils Classes
  • Avoid using editable tables, Use forms to edit data of tables
  • Avoid editable primary key attribute
  • Close iterators after use
  • Use ADF Logger instead of System.out.println
  • Choose bean scope carefully, lots of problems occur due to wrong bean scope
    Memory Scope For ADF Managed Beans-As per Fusion Developer guide
  • Don’t use getDBTransaction().postChanges unless you have a commit operation in the same request
  • Check for null values instead of using try/catch block everywhere
  • Avoid circular dependency of the list of values
  • Use createRowSetIterator() for view object programmatic iteration instead of using AllRowsInRange
  • Always use readOnly viewObject for view based or reference data, This helps in performance as it avoids EntityCache
  • Write business logic in model level implementation classes as AMImpl/VOImpl and call those methods in bean using binding layer
    ADF Basics: How to invoke model layer methods from the managed bean (Best Practice to write business logic in ADF)
  • Implement bean serialization for applicationScope, sessionScope, pageFlowScope beans
  • ADF Faces requires only one root component per fragment
  • Ensure uniqueness of taskflow name, managed bean name and application module name in the entire application
  • Always check for null values while calculating transient attributes default values
  • Don’t write bulky and unnecessary code in accessors of components or attributes as accessors are called multiple times so it’ll affect performance
  • Catch Jbo Exceptions while calling pl/sql functions/procedure and show as a message on the page instead of showing ADF/DB generated messages
  • To apply validation and autoSuggest like feature in search form use custom search instead of af:query component
  • Ensure that component bindings should be in a request scoped bean not greater than that
  • Instead of using setWhereClause() use query based bind variable to improve performance
  • Use basic tuning in ViewObjects to fetch rows from DB to improve performance
  • Don’t set immediate true for editable input components
  • Don’t use cached application module reference in bean instead of caching, look for AM when required as it is a pooled resource that’s why it is never guaranteed that you will get same AM instance over a period of time. You’ll end up getting lots of Null Pointer Exceptions
  • Don’t use RowId as primary key in entity object , To avoid this define primary key in DB table itself
  • Never use SELECT * FROM in viewObject instead specify required column names
  • Avoid ViewObject expert mode for entity based viewObject. To add where clause , order by clause use viewObject or view object based bind variable

 

Related Posts

An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF

0 thoughts on “Oracle ADF Best Practices, Mistakes and Worst Practices”

Leave a Reply

Your email address will not be published. Required fields are marked *