Tuesday, December 29, 2015

Very Practical CRUD with JET and ADF BC - POST and DELETE Methods

In my previous post I have described how to implement PATCH method with Oracle JET and call ADF BC REST service to update row attributes - Very Practical CRUD with JET and ADF BC - PATCH Method. Today I'm going to complete CRUD implementation with POST and DELETE methods, to create and delete rows through ADF BC REST service and JET UI.

Here you can watch video, where I demonstrate PATCH, POST and DELETE methods invoked from JET UI. Also you are going to see how pagination works with JET paging control and ADF BC range paging mode (Oracle JET Collection Paging Control and ADF BC REST Pagination Perfect Combination):

Download sample application - JETCRUDApp_v3.zip. This sample app contains JET UI and ADF BC REST implementation. I'm going to explain in more detail steps recorded in the above video.

Salary column was updated with right align in the new sample, in JET we can assign class name for table cell:

JET supports date formatters and converters. I was using yyyy-MM-dd pattern to format Hire Date attribute value:

POST method - row creation

New row is created with JET collection API method create. I have implemented success callback, if POST method in REST was successful and new row was inserted - collection is refreshed to display new row. There is no need to refresh, if collection is not virtualized (fetchSize and pagination is not used):

DELETE method - row removal

Row is removed from JET model with API method destroy. This calls DELETE method triggering REST service and removes row from JET collection, by refreshing current page (invoking GET method for collection page):

POST method test. Example of new row creation:

POST method is invoked by JET, which in turns calls ADF BC REST service and inserts new row through ADF BC into DB:

PATCH method test. Example of attribute value update. I have changed Salary attribute value:

Row with ID is updated by PATCH method through REST service call:

DELETE method test. Example of row removal:

Row with ID is removed by DELETE method through REST service call:

In my next posts I'm going to describe how implement validation and handle REST call errors.


Anonymous said...

Hi Andrejus. Great posts about REST and JET.
I have a requirement to delete a row in a table ta has a 2 column Pirmary Key. How can i make that REST call? How can i pass the parameters to identify the 2 column PK?

Thank you.

Vipin Kumar said...

Hi Andrej;

How to run this application. I am able to run the rest project but not the UI.


Andrej Baranovskij said...

JET pproject you need to open in NetBeans with JET extension, run HTML index page from NetBeans.


Karmveer Soni said...


I am able to run the project but no UI components are getting displayed.

Blank Html populates on index.html.

I am using NetBeans 8.2 and oj 3.2.0.


Andrej Baranovskij said...

You need to add JET distribution libraries to JET project (they are removed to save space).