An Entity Object provides an object representation of the data it caches from a row in a database table. Each database table is represented as an individual Entity Object, with the table's columns corresponding to Entity Object attributes. Entity Objects can also be based on views, snapshots, or synonyms. An Entity Object encapsulates the business logic and database storage details of your business entities. The business logic that you define in a single place (the Entity Object) can be reused across clients.
Just as a database table can carry certain constraints, you can modify an Entity Object's attributes to specify validation rules (also called business rules) and methods. Validation rules can ensure that:
The values returned by a query are valid
Users do not enter invalid data into a table
The following figure shows an Entity Object named Emp based on the EMP table. The developer of this Entity Object has also added a validation rule to specify that an employee's salary must be greater than 700.
You can define a relationship between two Entity Objects by using an Association. An Association defines a relationship between two Entity Objects and matches attributes from source and destination Entity Objects. Typically, these attributes represent key fields in a database table, but an Association can be defined using any Entity Object attributes.
Entity Objects are not directly exposed to the client tier. Instead, clients access data through View Objects: clients use View Objects to get and set attribute values, and changes are made to the data in the underlying database when the transaction is committed. Entity Objects and View Objects communicate directly by using events and Java calls (not by using remote interface proxies).