Refactoring the EJB APIs
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."
Srini Penchikala Aug 21, 2014