Refactoring the EJB APIs

| by Floyd Marinescu Follow 28 Followers on Jun 16, 2006. Estimated reading time: 1 minute |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

Artima has interviewed EJB 3 spec lead Linda DeMichiel on how EJB was refactored for simplicty between EJB 2 and EJB 3, including three separate spec documents, simplifying EJB interfaces, annotations, dependency injection.

The EJB specification is now delivered in three documents, the core contracts document, the Java Persistence API document, and the EJB 3 Simplified API document (intended as a shorter developer guide). The JPA document arised out of the need to have a standard O/R mapping standard for Java outside of EJB. The move also appeased people who were angry about Sun shutting out JDO (incidentally, there is another JDO vs. EJB debate on TSS).  

On when to use annotations vs. when to use deployment descriptors, Linda replied that metadata that is intrinsic to the application and unlikely to ever change  (environment entries, transaction attributes, entity relationships) should be stored as annotations, whereas data that need may need to be changed later (security roles, table level mapping if DB portability is a concern) should be externalized into deployment descriptors. Another use would be for for interceptors "that apply to all of the components in an EJB JAR...given the absence of application-scoped metadata annotations, you'd use the deployment descriptor for that."

The EJB spec is no longer written around the idea that EJB's are always remote components. The default infact assumed to be local. EJB[Local]Object interfaces have been changed to to be plain busines interfaces, which is local by default, "but you can specify it as remote either by annotation of the interface or the bean class, or using XML."  And best of all, RemoteExceptions are no longer required, instead "EJBExceptions are thrown. If needed, the developer can unwrap those EJBExceptions to expose whatever the protocol-level exception was, and handle that exception in an appropriate way."

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you