Best Practices
Best Practices & Notes:
===================
please watch every day update :
-------------------------------------===================
please watch every day update :
ADF - TABLE : Primary Key
While working with table, ADF always expects a predefined primary key for the table. We can create a primary key using DB sequence or other alternative options. If you do not have a PK for a table, during scrolling or selecting a row within the table or creating an empty row and scrolling to next set of rows, we will get a weird result.
Example for Sequence PK: (Groovy Expression)
(new oracle.jbo.server.SequenceImpl("TEST_SEQ",adf.object.getDBTransaction())).getSequenceNumber()
Just a note:
ADF - TABLE : Custom Partial Trigger
We can add table selection listener programmatically with declarative component using the following snippets of code :
_getTable().addSelectionListener(new SelectionListener(){
@Override
public void processSelection(SelectionEvent selectionEvent) throws AbortProcessingException {
AdfFacesContext.getCurrentInstance().addPartialTarget(getToolBar());
}
});
You can also refresh the toolbar through table selection listener.
public void onRowSelection(SelectionEvent selectionEvent) {
.
invokeEL("#{bindings.VDept.collectionModel.makeCurrent}", new Class[] {
SelectionEvent.class }, new Object[] {
selectionEvent });
AdfFacesContext.getCurrentInstance().addPartialTarget(getToolBar());
}
View Criteria Filter - Transient Attribute: - Note
=====================================
If the attribute is a transient attribute, you need to set the 'Query Execution Mode' of the ViewCriteria to either InMemory or Both for the filtering to work.
Faces Message - Note
=================
Suppose an application has two pages. If you add a faces message programmatically as given below during some button click from the first page & if you expect the message should shown in the second page, then you are wrong.
FacesContext fc = FacesContext.getCurrentInstance();
fc.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "1st","1st Error")
return "one";
Why?
FacesMessages are always associated with the view. If the view changes, the messages from the previous view are not applied to the second page.
Better to throw a validation exception from a legal validator during the validation phase and the rest would be taken care by the framework.
LOV - Note
=========
Problem :
If you entering an input value into the LOV search field, which is not
unique and you open the LOV popup, a ClassCastException occurs:
java.lang.ClassCastException:
oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding cannot be cast to oracle.jbo.uicli.binding.JUCtrlListBinding
Solution: Please check your lov configuration setting whether you are using the same VO properties to build the LOV too.
Association Consistency
===================
when we create a new entity row or update an entity attribute, this change is going to be replicated to the view objects based on the same entity. If we get any problem during the row creation within the table without selecting existing row, try to override create() method with setAssociationConsistent(true) flag.
Example :
=======
@Override protected void create() { super.create(); setAssociationConsistent(true); }
Scroll Policy Recommendation
========================
when the access mode of the vo is set to Range paging, please use scrollPolicy of the table is set to page instead of scroll/auto.
ViewRowSet Duplicate Records
=========================
If you find some duplicate rows with viewRowSet, please use the below notes to debug :
- The duplicate row is probably coming from a new, unposted row. Such a row can be added to the QueryCollection when association consistency is true.
- It can be added when a new entity row is inserted or when the QueryCollection is executed.
We can debug in the following areas :
1) ViewObjectImpl::afterRowUpdate() - you will see a call to createNewRowInQC towards the end. This is the entity insertion case.
2) QueryCollection::findUnpostedRows() - you will see a call to addUnpostedRowsFromECache. This is the executeQuery() case.
3) QueryCollection::nextRowFromEntityCache() - this is called during row retrieval if the VO's query mode includes QUERY_MODE_SCAN_ENTITY_ROWS.
How to Synchronize the ADF view fetch size with the ADF model range size?
============================================================
recommend to use oracle.adf.view.rich.SYNCROWS context parameter in web.xml.
One scenario would be the table scroll & edit functionality of any selected row. If this properly is not enabled, edit operation end up with weird result. ie) instead of the selected row, some different row may get displayed in the edit popup.
I don't understand what you mean by this:
ReplyDeleteLOV - Note
=========
Problem :
If you entering an input value into the LOV search field, which is not
unique and you open the LOV popup, a ClassCastException occurs:
java.lang.ClassCastException:
oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding cannot be cast to oracle.jbo.uicli.binding.JUCtrlListBinding
Solution: Please check your lov configuration setting whether you are using the same VO properties to build the LOV too.