Book Image

Oracle JDeveloper 11gR2 Cookbook

By : Nick Haralabidis
Book Image

Oracle JDeveloper 11gR2 Cookbook

By: Nick Haralabidis

Overview of this book

Oracle's Application Development Framework (ADF) for Fusion Web Applications leverages Java EE best practices and proven design patterns to simplify constructing complex web solutions with JDeveloper, and this hands-on, task-based cookbook enables you to realize those complex, enterprise-scale applications. With the help of real-world implementations, practical recipes cover everything from design and construction, to deployment, testing, debugging and optimization. This practical, task-based cookbook takes you, the ADF developer, on a practical journey for building Fusion Web Applications. By implementing a range of real world use cases, you will gain invaluable and applicable knowledge for utilizing the ADF framework with JDeveloper 11gR2. "Oracle JDeveloper 11gR2 Cookbook"ù is a task-based guide to the complete lifecycle of Fusion Web Application development using Oracle JDeveloper 11gR2 and ADF.You will get quickly up and running with concepts like setting up Application Workspaces and Projects, before delving into specific Business Components such as Entity Objects, View Objects, Application Modules and more. Along the way you will encounter even more practical recipes about ADF Faces UI components and Backing Beans, and the book rounds off by covering security, session timeouts and exceptions.With "Oracle JDeveloper 11gR2 Cookbook"ù in hand you will be equipped with the practical knowledge of a range of ready to use implementation cases which can be applied to your own Fusion Web ADF Applications.
Table of Contents (19 chapters)
Oracle JDeveloper 11gR2 Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface

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...

  1. 1. Open the DepartmentImpl custom entity implementation class and override the doDML() method using the Override Methods dialog.

  2. 2. Add the following code to the doDML() method before the call to super.doDML():

    // check for insert
    if (DML_INSERT == operation) {
    // get the department employees accessor
    RowIterator departmentEmployees = this.getDepartmentEmployees();
    // check for any employees
    if (!departmentEmployees.hasNext()) {
    // avoid inserting the department if there are no employees...