Hi All,
I'm fairly new to ADF and require some help with regard to best practise for implementing CRUD type functionality.
Conceptually I wan't to use a
single page for
creating, viewing and updating and have have the following components
- summaryVO (based on sql query)
- detailVO (based on detailEO)
- SummaryView.jspx (which uses summaryPO for ADF Table)
- ViewEditCreate.jspx (which uses detailVO for ADF Form)
So basically I would like to
re-use the same page for creating, editing and updating detail records.
At the moment I have not experimeted with Edit but I believe I have a working solution for using the same page to both view and create a new record. However I do not know whether what I am doing is the best approach.
To use the page to VIEW a selected record I performed the following:
- Created SummaryView.jspx page and added an ADF table with tableSelectOne
- Set up a view link from the key value in summaryVO to detailVO
- Set up the AM to use the summary VO and ViewLink
- Added an ADF Form to the ViewEditCreate.jspx page using the detailVO nested within summaryVO within the data control palette.
- Added a standard command button called "View" to the SummaryView.jspx that links to the ViewEditCreate.jspx detail page.
I then ran the page and tested the functionality.
Seems to work ok (except browser back - but that is another issue though I think I know how to fix).
In addition to the above to use the page in a CREATE mode I performed the following:
- placed a command button based on the "CREATE" operation within the data control palette on the SummaryView.jspx
- overrided the create() method in the detailVOImpl file to do:
this.getDBTransaction().clearEntitiyCache(detailEO name)
this.refresh(REFRESH_WITH_DB_FORGET_CHANGES)
I had to override the above method to prevent a "Too Many objects match the primary key" error.
In the developer guide it mentions using #{row.rowKey} and #{requestScope.requestRowKey} for viewing records however I couldn't get this working. After selecting a record from the summary and clicking view the detail page pulled back a record but did not synch correctly with the record I selected as it did with a view link.
From experience can anyone suggests a best practise and provide a short description of how best to implement this type of functionality.
Kris