Friday, November 25, 2011

Oracle ADF 11g Table Insert with Empty Insert Row

Guess what ADF topic remains most popular over the years - CRUD. I have several blogs on this topic, for example - CRUD Operations in Oracle ADF 11g Table Without Auto PPR. Today I will describe one more scenario - how to maintain empty row, which can be used to insert new records into table.

Download sample application - TableInsertApp.zip. This example contains ADF table with empty row in the footer:


User is able to type data into empty row:


Press Insert button and populate new row into table rowset:


Good thing - empty doesn't care about validation, because all business rules will be checked ones user hits Save button (in this case, primary key is missing):


Fix validation error, now commit is successful:


How we implement empty row? Pretty easy, with SELECT ... FROM DUAL VO - JobsEntryView:


This VO should have as many attributes, as original VO:


SELECT ... FROM DUAL allows to query only 1 row into rowset. Make sure all attributes are set to be Updatable always, as well as with correct precision type, etc. (same as original VO, except we don't need validation rules):


On the UI part, each column footer is populated with corresponding attribute from our read-only VO:


Create operation is doing deep copy of attribute values from read-only VO into main VO (and clearing insert row):


4 comments:

Svatik79 said...

Thanks for the post, Andrejus.. and nice greetings from Prague! ;)

Cheers, Svata

Andrejus Baranovskis said...

My pleasure ! ;)

Unknown said...

Hi ,
I have been having unfamiliar error of JBO-25003: Object root of type View Object is not found as a pop up. when that pop shows up the table selection listener and filters on tables fails to work.
My application does not use Oracle BC in any place. The application use POJO to create table bindings. The funny part of that error is that it occurs after sometime when more people are accessing it.
Can I get the solution for it. My stack trace is

: Object root of type View Object is not found.
oracle.jbo.NoObjException: JBO-25003: Object root of type View Object is not found.
at oracle.adf.model.binding.DCIteratorBinding.getViewObject(DCIteratorBinding.java:1507)
at oracle.adf.model.binding.DCIteratorBinding.getViewObject(DCIteratorBinding.java:1347)
at oracle.adf.model.binding.DCIteratorBinding.initSourceRSI(DCIteratorBinding.java:1689)
at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1654)
at oracle.adf.model.binding.DCIteratorBinding.internalGetRowSetIterator(DCIteratorBinding.java:1630)
at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4300)
at oracle.adf.model.binding.DCExecutableBinding.refreshIfNeeded(DCExecutableBinding.java:342)
at oracle.adf.model.binding.DCIteratorBinding.getRowSetIterator(DCIteratorBinding.java:1592)
at oracle.jbo.uicli.binding.MyIteratorBinding.initSourceRSI(JUAccessorIteratorDef.java:764)
at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1654)
at oracle.jbo.uicli.binding.MyIteratorBinding.executeQuery(JUAccessorIteratorDef.java:718)
at com.brandleysystems.selectClient(ClientEnd.java:46)

Anonymous said...

I have a master form and detail table. I am using strong association and works fine. But I want to show more than one blank rows in detail table based on a value in one of the field in master form. I am getting client validation error when calling second creatinsert on detail table. Pls advice.