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):


2 comments:

Svatik79 said...

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

Cheers, Svata

Andrejus Baranovskis said...

My pleasure ! ;)