Accessing an Entity Bean
As we know, an entity bean is an EJB that represents a unique instance of an entity in a permanent data store. Each entity bean is represented by a unique ID: a primary key. Unlike session beans, which are usually created for use, an entity bean represents persistent data and is therefore usually found and retrieved from the data store.
The previous example showed the use of JDBC in a helper object for a session bean. The helper object implemented the Data Access Object (DAO) design pattern, which isolates and encapsulates the data access activity into a coarse-grained object. By using this design pattern, the details of the data and the data access are isolated from the session facade bean.
DAOs can also have utility ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access