Today over in the JDeveloper discussion forum on the Oracle Technology Network, some advanced BC4J framework users are asking about a feature enhancement to allow BC4J view objects to be based on other views.
In fact, if we allow an entity object to be based on a view object, this would enable quite sophisticated multi-table mapping capabilities without adding any new concepts to the framework. We've definitely thought of this in the past, but have only begun to see user demand for the idea in the last few months. To be honest, in late 1997 when we demonstrated the first alpha version of the BC4J framework to Larry Ellison, one of his first questions during the demo and overview was, "Can view objects be based on other view objects?" So, the idea has definitely been on our radar since the beginning.
Entity objects and View Object rows were designed to have a lot in common (e.g. oracle.jbo.server.Entity extends oracle.jbo.Row). It's the roles they play in the different application layers that are different.
View objects define an arbitrary SQL query and produce rowsets. The view object holds the metadata about the structure of those view rows, and how attributes in the client-accessible view row "value objects" relate to zero or more related entity object "usages". The view object manages collections of view rows called RowSets.
Entity objects are business object instances with validation and business logic, having a row-like attribute storage structure. The "entity definition" object (oracle.jbo.server.EntityDefImpl) holds the metadata about the structure of those view rows, and how attributes in the middle-tier-only-accessible business object map to database table columns (if any). The entity definition object plays the role of a factory/home for entity instances and manages a collection of entity instances in an entity collection (cache).
While the view object uses its arbitrary SQL query to find zero or more view rows, the entity definition object looks up an entity instance exclusively by primary key.
You can use view objects and their arbitrary SQL queries to expose custom entity-object-level "finders", as well. On the view link "View Link Properties" panel, there are checkboxes that control whether accessor methods are exposed at the view object level and/or the entity object level.
10:21:58 AM
|