What does EJB really give me?

EJB lets you focus on the business logic for your business, and leave the underlying services (transactions, networking, security, etc.) to the EJB server vendor.

Imagine you work for Guitar Land, a company that sells musician’s gear online. You have better things to do than work 90 hours a week, so where would you want to spend your time? Wouldn’t you rather concentrate on how Guitar Land does business online, as opposed to writing your own secure, networked, transaction management server? Why not work on what you know best (business logic for your particular business), and leave the heavy lifting (i.e. the big infrastructure services you get from the server) to someone else?

The EJB model is to let everyone do what they do best—the server vendors concentrate on the infrastructure that most enterprise applications need, while the business developers concentrate on their own business logic.

image with no caption

EJB let’s you customize and configure reusable components at deploy-time, without touching the source code!

You can change the way a bean uses the underlying services simply by tweaking an XMl document at deploy-time. For example, you can completely define the security access control for a bean’s methods within XML (declaratively) rather than within the bean’s source code (programmatically). And you can customize the way a bean’s methods run in transactions, all within the deployment descriptor, without having to hard-code in transaction boundaries and behaviors. That just rocks.

EJB servers give you a bunch of services, so that you don’t have to write them yourself:

  • Transaction management

  • Security

  • Concurrency

  • Networking

  • Resource management

  • Persistence

  • Messaging

  • Deploy-time customization

Note

Somebody already wrote and tested all this stuff, so you don’t have to.

image with no caption

Get Head First EJB 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.