Skip to main content

What if you missed the Key definition for a ViewObject ?

When you create ViewObject WITHOUT choosing EntityObject as data source, there are chances that you may forget to define Key for the generated ViewObject. Actually the Key definition play a very vital role when ADFm(binding layer) comes in to picture. Many of the binding specific APIs make use of the 'Key' from the ViewObject to identify rows uniquely. Let me share a couple of issues that may arise if you miss out Key definition for a ViewObject

1. RichTable::getRowData() returns null.

Please see the below shown code snippet. This code is typically used to get the data for the selected rows for a table from the backing bean.

RowKeySet selectedRowKeys = someTable.getSelectedRowKeys();
//Store original rowKey
Object oldRowKey = someTable.getRowKey();

if (selectedRowKeys != null) {
    Iterator iter = selectedRowKeys.iterator();
    if (iter != null && iter.hasNext()) {
    Object rowKey =;
    someTable.setRowKey(rowKey); //stamp row
    JUCtrlHierNodeBinding rowData =
    //Do something here
//Restore the original rowKey
If you don't have Key defined at ViewObject level, call to someTable.getRowData() may return null. In that case, solution is to revisit your ViewObject and define a Key :)

2. Hitting the "java.lang.IllegalStateException: ADFv: Not inside a container error" when a tree(tree table) node is expanded by the user.

java.lang.IllegalStateException: ADFv: Not inside a container.
        at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.exitContainer(
        at oracle.adfinternal.view.faces.model.FlattenedTreeCollectionModel.getRowIndex(

As a first step to debug this error, please check the underlying ViewObject to ensure the Key definition for the same.

Please note that there may be multiple reason for the above listed error(s). What I'm sharing in this post is just one among many reasons. Let this be a staring point while debugging issues with similar symptoms :-)


ADF OAF Tech said…
Your post helped as usual. Thanks Jobinesh

Popular posts from this blog

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!