BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Refactoring the EJB APIs

by Floyd Marinescu on Jun 16, 2006 |
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."

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

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT