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.

Suggestion: If all primary key attributes have the same name, for example Id,<br />

retrieving sequence values from the database in the create method is<br />

something you could implement in your BC base classes. By doing so, you do<br />

not need to implement a create method for each entity object. In the EO base<br />

class you can retrieve from one sequence that is used for all Entity Objects. Or<br />

you can implement a more sophisticated mechanism that derives the sequence<br />

name from the Entity Object name.<br />

3.2.4.2. Surrogate Primary Key populated in the database<br />

The database generates the primary key value, so no Java code is needed to populate the<br />

primary key. However, your Business Components Model needs to know that values get<br />

refreshed in the database after the insert.<br />

ADF Developer’s <strong>Guide</strong>, section 6.6.3.8 “Trigger-Assigned Primary Key<br />

Values”.<br />

http://download-west.oracle.com/docs/html/B25947_01/bcentities006.htm#sm0147<br />

When you plan to create screens that insert a master row and one or more detail rows in<br />

one transaction, you will need to ensure that ADF BC first posts the master row and then<br />

the detail rows, otherwise ADF BC will not be able to set the foreign key of the details<br />

rows correctly. To enforce this posting sequence, you should mark the entity association<br />

as “Composite Association”.<br />

Note that when you mark an association as composite, the detail entity object can only be<br />

created as a detail of the master entity object, which means you cannot create a page that<br />

directly creates detail entity object, in addition to the master-detail page. If you try to do<br />

so, you will get error JBO-25030: Failed to find or invalidate owning entity.<br />

3 - 8 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!