I've added two new examples to my Not Yet Documented Examples page:
34. Conditionally Refreshing Associated Entities via Accessors, Driven by Component Metadata
This sample illustrates some generic framework extension code to customize how the Entity object works so that associated entities can be conditionally refreshed from the database. By default, accessing associated entities using entity accessor attributes will fetch the entity into the entity cache if not there already, but subsequently use the cache to satisfy the attribute access. This technique illustrate how you can use custom entity object metadata properties to annotate particular entity object accessor attributes where you want to eagerly refresh the value of the associated entity (or entity rowset, in the case of a 1-to-many association) whenever its accessed. A key design principal of the ADF Business Components layer of Oracle ADF is that it uses the database as its shared cache between different user's work. Each root application module instance has its own related transaction where local data is read and cached before any changes get committed, but within the span of a single transaction if user 1 has read and cached an entity object while simultaneously user 2 has read, updated, and committed a change to that same entity, user 1 will continue to "see" the object as it is in his cache. Selectively performing this eager refreshing of certain key entities can insure that business logic written using entity accessor attributes will always see the latest changes made by any user session during its current transaction. Notice the overridden getAttributeInternal() method in the MyEntityImpl class, and the custom metadta properties on the Dept and Emp entities in the sample. Launch two separate Business Components tester instance to simulate two parallel user transactions, and try updating the value of a Dept.Dname to "XXX" in one tester and committing it, then seeing that the Emp-level business rule fails validation. Conversely, try updating an Emp.Ename to "XXX" in one tester instance and committing it, then seeing that the Dept-level business rule values validation.
35. JDev 9.0.4 JSP DataTags Example Showing Attribute in Search but Not in Results
This example slightly alters the DataTableComponent.jsp for the default <jsp:DataTable> tag to add in an "if" block to allow developer-picked view object attributes to be hidden in the result display table. It skips over displaying the view object attribute if the custom BC4J attribute property named HideInTable is set on that attribute.
As always I apologize in advance that these little sample applications are not yet fully documented to the extent that I usually try to do with something like my Building J2EE Applications Using JHeadstart for ADF tutorial or the ADF Toy Store Demo, but time does not currently permit. Hopefully they are still simple enough to be fairly self-explanatory.
10:15:04 PM
|
|