Interaction Between Views and Entities: Retrieving Data
A view object typically gets its data by using a SQL query, and a view object is usually bound to an entity object. This slide should help to explain these two apparently conflicting pieces of information. View objects and entity objects work together when a view object retrieves data:
The view object queries the database, ensuring that its data is current.
Data retrieved by the query is saved to the entity object’s cache.
A calculated attribute is based only on a database query, not on an entity object’s attribute. Calculated attributes get their data directly from a column expression in the SQL query; the data is stored in the view object’s cache.
The data is passed to the entity object to validate business rules stored in the object. The view object determines what data is retrieved. The entity object guarantees that the data follows the defined business rules.
Values in view object rows and entity object rows remain coordinated.