Add-Edit multiple rows using EJB DC
By Deepak Siddappa on Jul 31, 2013
Let us take a scenario where in users wants to add/edit multiple records in the ADF table, earlier with stateless session bean we need have work around to achieve this scenario.
This scenario can be achieved using stateful session bean, the application-managed transaction model for EJB/POJO data controls which additionally maintains a cache of managed entities and using commit operations user will be able to add/edit multiple records.
Create Java EE Web Application with entity based on Dept(sequences enabled on deptId), then create a stateful session bean with Transaction Type as "CMT with Explicit Commit" and data control for the session bean. "CMT with Explicit Commit" supported in Oracle JDeveloper 126.96.36.199.0
In View controller project, create jspx page. Drop deptFindAll->Table/List View as ADF Table with multi-selection option enabled.
Run the jspx page (i.e the web page look something like the image shown below). Notice here the commit button will be disabled. Once user click on the create button, commit button will get enabled.
Here we will create two records, so clicking the create button twice. Enter the dept details and click on commit button to save the records. You can also configure @SequenceGenerator/@TableGenerator to auto generate the DeptNo.
Result page should contains newly added records.