Using doDML() to enforce a detail record for a new master record
In this recipe, we will consider a simple technique that we can use to enforce having detailed records when inserting a new master record in an entity association relationship. The use case demonstrates how to enforce creating at least one employee at the time when a new department is created.
Getting ready
We will use the HR
database schema and the HRComponents
workspace that we have created in previous recipes in this chapter.
How to do it...
- Open the
DepartmentImpl
custom entity implementation class and override thedoDML()
method using the Override Methods dialog. - Add the following code to the
doDML()
method before the call tosuper.doDML()
:// check ...
Get Oracle JDeveloper 11gR2 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.