Beans come in three flavors
Entity

Use an entity bean to represent a thing in a persistent store. That almost always means something in a database, where an instance of an entity bean represents a row in a table (although if the database is normalized, the bean might be drawing from rows in multiple tables). A typical entity example is Customer, where one entity might represent Bo Olean (ID# 343) and another entity might represent Trixia Lin (ID# 870).
Message-driven
Use a message-driven bean only when you need a JMS consumer. In other words, a bean that can listen for messages from a JMS messaging service. Clients never call message-driven beans directly; in order to get a message-driven bean to do something, a client must send a message to a messaging service. That means a message-driven bean has no EJBObject because the server gets the client requests directly from a messaging service rather than as a call from the client to the bean. A typical message-driven bean might be a NewCustomerNotification subscriber.


Session
Use a session bean for... everything else. Almost any kind of back-end ...
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