I've added example # 36 to my Not Yet Documented samples page:
Composite Entity Using Stored Procedure API to Create/Modify/Remove Master and Children
Although still not comprehensively documented, the commented sample code illustrates a more complicated scenario of building a set of composed entity objects which accomplish their underlying DML operations by calling a PL/SQL API that accepts multi-level Oracle object types and internally handles the DML operations for both parent and child in one shot. The example tries to build on a common pattern where the view objects and entity select are accomplished against database views, while the entity object DML operations happen against the simple PL/SQL API:
package dept_service is procedure add_dept(p_dept in out dept_t); procedure remove_dept(p_deptno number); procedure update_dept(p_dept in out dept_t); end;
The dept_t object type is defined to match the structure of a row in the DEPT table, along with having a nested emps attribute that is a table of emp_t types, matching the structure of the EMP table. Both the Dept.Deptno and the Emp.Empno attributes are populated from DB triggers from a sequence, so the example code illustrates also how to simulate the refresh-after-insert behavior that the framework would normally perform on your behalf.
You can test out using the Business Components tester.
11:26:02 PM
|