2.4.1 ADF Customization Best Practices - Do's
- If there is a custom AM (Application Module) created as part of custom application, then you can nest it under base root application module. It’s recommended to keep base application module as the main root module and route all custom transaction through it.
- You always need not explicitly create AM instances in backing beans. Instead create custom method in AMImpl class, expose them as client methods, and use operation bindings to call such methods.
- Use finally block to close expensive objects like RowSetIterators, Statements and Connections, wherever applicable.
- Every request that changes data in database should be complete i.e. commit or rollback must happen at the end of request.
- Try to reuse View Objects (VOs). This is true for data display and list of value VOs.
- New VOs should be tuned according to the business use case by tuning the fetch size and fetch mode properties.
- Use Bind Variables in VOs instead of hardcoded values in WHERE Clause, even for static values.
- If new custom bounded taskflows are created to show data in new tabs then make sure to control the taskflow activation and fetch data only when needed. For example, on click of tab rather than launch of page itself (assuming that tab is not the first tab).
- Write layer appropriate code i.e. avoid business logic in view layer. Another indicator to know would be, if you are importing jbo.* classes in view layer (backing bean) then you are misplacing the code and it actually belongs to model layer.
- Test with AM pooling off to make sure there is no adverse impact of passivation of AM, especially to transient and user entered values.
- Ensure that the ID for each component in the fragment is less than or equal to 7 characters in length.
- When bindings are created in the backing bean for any of the component in the fragment, ensure to use component references and not the component directly. Refer to below examples on the usage.
- Example of correct usage:
private ComponentReference<RichInputText> scraOrderRefNbr; public RichInputText getScraOrderRefNbr() { return scraOrderRefNbr == null ? null : scraOrderRefNbr.getComponent(); } public void setScraOrderRefNbr(RichInputText scraOrderRefNbr) { this.scraOrderRefNbr = CommponentReference.newUIComponentReference(scraOrderRefNbr); }
- Example of wrong usage:
private RichInputText doNotUse; public void setDoNotUse(RichInputText doNotUse) { this.doNotUse = doNotUse; } public RichInputText getDoNotUse() { return doNotUse; }
- Any calls to DB packages should be done from the AM Impl method (Not applicable for pre/post insert/update which will be done directly at the respective Entity Impls) and that method should be invoked from the backing bean through operation binding, so never call the DB packages directly from the backing bean.
Parent topic: ADF Customization Best Practices