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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A view Object key that is updateable might result in unexpected behavior in the web tier.<br />

For example, if you update key attribute values in an ADF Faces table, the row<br />

management feature might not work correctly anymore.<br />

To ensure the above two conditions are met; you must perform different tasks,<br />

depending on whether the View Object is Updateable or Read-Only.<br />

3.3.3.1. Unchecking Reference Key Attributes for Updateable View Objects<br />

An updateble View Object based on only one Entity Object, will inherit its key<br />

attribute(s) from the underlying Entity Object, which in turn is inherited from the<br />

underlying table’s primary key. Assuming you have applied common sense database<br />

design guidelines, the primary key is not updateable, hence the View Object key is read<br />

only as well. So far so good, however, when you start adding “Reference” Entity Objects<br />

to the View Object, for example to join lookup data in the query, ADF Business<br />

Components will add the key attributes of the reference Entity Object to the key of the<br />

View Object (JDeveloper bug 6804062, fixed in 11g).<br />

For example, we want to display the Department Manager Name on a page that lists all<br />

departments. We need to join the Departments table with the Employees table in the<br />

View Object query. The easiest way to do this is by adding the Employees Entity Object<br />

as Reference Entity Object, as shown in the picture below.<br />

Once you added the Employees Entity Object, and added some Employee attributes to<br />

the View Object, ADF Business Component nicely changes the SQL statement for you to<br />

join with the Employees table. However, the key attribute of the Employees Entity<br />

Object, EmployeeId is also checked, effectively adding this attribute to the Key of a View<br />

Object Row. So, ADF Business Components silently made your Row Key updateable.<br />

When you subsequently use <strong>JHeadstart</strong> to generate a List of Values window to change<br />

the manager of a department in a table layout, you will notice that the LOV values are<br />

not returned as expected. This is because the Row Key has changed in the middle of this<br />

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

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

Saved successfully!

Ooh no, something went wrong!