O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Session Beans Versus Entity Beans

By now, you already have a good concept of the difference between a session bean and an entity bean. The question now is, how do you go about using them from a client? Furthermore, do you even need both types of beans?

Typically, your clients don't access entity beans directly. Some EJB architects make this a hard and fast rule; others aren't as restrictive. The main reason you don't access entity beans directly is that you generally need to invoke several methods on an entity bean to perform an operation. This would require you to manage the transaction from the client, which is not very efficient.

Another reason you don't want to use entity beans directly is that the entity beans typically represent data objects ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required