Skip to main content

Does ADF allow you to change Primary Key attributes from UI?

I talked about some use case which calls for Primary Key update from UI and their solutions long back in one of my old post  This post is in continuation of the same discussion. Good news is that the release of ADF started supporting a specific use case that involves PK change. To make it clear, ADF out of the box supports/handles the scenario in which your entity object's primary key attribute is populated by database trigger when you post the newly created row(or any PK changes during postChanges operation,  while committing a transaction). To leverage this support, you may want to keep Refresh on Update or Refresh on Insert flags (as appropaite) to " true" for the Primary Key attributes (which get updated during posting changes to DB) in the entity object. Note that ADF (ADF Faces when used along with ADF binding and Business Components) officially does not support(not certified) any kind of primary key update from UI(ADF Faces). If you see a reason for allowing user to update Key attributes from UI, then always use Surrogate Key approach, which can be enabled through DB Sequence.

Note that, in the above post I'm talking about updating primary keys from UI(where update from UI reaches underlying entity object through ADF binding layer).  To clarify, PK update support at business component level is available since, however same through UI (which is bound to business components through ADF binding) is not certified.


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…