Overriding remove() to delete a parent entity in an association
In this recipe, we will present a technique that you can use in cases that you want to delete the parent entity in an association when the last child entity is deleted. An example of such a case would be to delete a department when the last department employee is deleted.
Getting ready
You will need access to the HR
schema in your database.
How to do it...
1. Start by creating a new Fusion Web Application (ADF) workspace called
HRComponents
.2. Create a database connection for the
HR
schema in the Application Resource section of the Application Navigator.3. Use the Business Components from Tables selection on the New Gallery dialog to create
Business Components
objects for theDEPARTMENTS
andEMPLOYEES
tables.4. Double-click on the EmpDeptFkAssoc association on the Application Navigator to bring up the Association editor, then click on the Relationship tab.
5. Click on the Edit accessors button (the pen icon) in the Accessors section...