Comparing Entity Beans and Session Beans

Entity beans differ from session beans in several ways. Entity beans are persistent, allow shared access, have primary keys, and may participate in relationships with other entity beans. Table 8.1 shows the differences between session and entity beans.

Table 8.1. Differences Between Session and Entity Beans
Session BeanEntity Bean
Typically contains business process logic, such as sending an e-mail, looking up the stock price from a database, implementing compression and encryption algorithms. They also implement business logic such as workflow, algorithms, and business rules.Typically represents business entities, such as customers, products, accounts, and orders.
Executes a particular business task on behalf ...

Get Sams Teach Yourself EJB in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.