In this post I am putting some practices and that we should follow while using Oracle Application Development Framework for development
- Call database (PL/SQL) function and procedure in model layer and then access in managed bean using page level bindings
ADF Basics: Call PL/SQL Stored function in ADF Application - Use Exception Handler in Taskflow where required
Global Exception Handler for ADF Task Flow Method Calls - Some ADF Component use animation for rendering like table, tree, popup. Consider animation-enabled false for better performance
This can be controlled through ADF Skin - Ensure that each EnityObject/ ViewObject must have a primary key
- 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 Clasees - 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 problem occurs 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 same request
- Check for null values instead of using try/catch block everywhere
- Avoid circular dependency of 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 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 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 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
I was looking about it, thanks for posting it!!
ReplyDeleteYou're Welcome :)
DeleteYou're always awesome, Thanks a ton man
ReplyDeletethank you
ReplyDeleteI just came here to thank you for the wonderful blog :)
ReplyDeleteLannisters Send Their Regards
ReplyDeleteThanks a lot, I have learned many things from you and I will learn more
ReplyDelete