14.01.2013 Views

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.3. Creating View Objects and Application Modules<br />

This section discusses the development tasks related to creating the data model layer,<br />

consisting of View Objects, View Links and Application Modules. The following topics<br />

are discussed:<br />

• Creating View Objects and View Links<br />

• Renaming View Objects and View Links<br />

• Inspecting and Setting Key Attributes of a View Object<br />

• Setting View Object Control Hints<br />

• Determining the Order of Displayed Rows<br />

• Creating Calculated or Transient Attributes<br />

• Setting up Master-Detail Synchronization<br />

• Defining View Links and View Object Usages for Lookups<br />

• Testing the Model<br />

3.3.1. Creating View Objects and View Links<br />

When creating a View Object you need to determine whether the data queried through<br />

the ViewObject should be updateable in the user interface (web pages). If so, you need to<br />

create an updateable ViewObject, which is based on a primary Entity Object. If the data<br />

is read-only in the user interface, it is more efficient to create a read-only View Object,<br />

which is a View Object not based on an entity object with a custom SQL query that you<br />

need to enter manually.<br />

A typical example of read-only View Objects, are View Objects used to populate lookup<br />

data in the user interface, typically exposed through a drop down list, or List of Values<br />

window.<br />

3.3.2. Renaming View Objects and View Links<br />

If you have used the “New Default Data Model Components” wizard, we recommend<br />

that you rename the View Objects and View Links to comply with the naming standards<br />

you have set up for your project (see chapter 2). If you create the View Objects and View<br />

Links one-by-one, you can assign proper names right away.<br />

3.3.3. Inspecting and Setting Key Attributes of a View Object<br />

Under the covers, an ADF Faces table uses the View Object findByKey() method for its<br />

row management. This row management is used by the ADF Faces table to update the<br />

correct underlying row, when a user has changed one or more values in the ADF Faces<br />

table. Built-in ADF Data Binding layer actions like setCurrentRowWithKey and<br />

setCurrentRowWithKeyValue also rely on the findByKey() method. For this method to<br />

behave reliably, two conditions must be met:<br />

• Each View Object must have at least one key attribute<br />

• The key attribute(s) should be non-updateable<br />

<strong>JHeadstart</strong> <strong>Developer's</strong> <strong>Guide</strong> Creating ADF Business Components 3 - 15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!