Enterprise JavaBeans v3.0 - Foreword

 
Foreword

         Enterprise JavaBeans™ is the core component technology of the Java Enterprise Edition platform. It is an enterprise infrastructure designed to provide developers with the automatic management of many of the services essential to enterprise applications. The EJB containerthe immediate environment of enterprise bean components and the provider of managed services to themis at the center of this architecture.

However, to use this managed environment in earlier versions of EJB, developers had to write to APIs that focused more on the EJB container's requirements than on the business logic of enterprise applications. Consequently, EJB development was unnecessarily complex. For example:

Implementation of various EJB interfaces led to a lot of boilerplate(样板文件) code for methods that were required by the interface, but not needed by the application.

An XML deployment descriptor was required to integrate the application with its environment and with container services. Access to the components' environment was clumsy and nonintuitive.

The design of container-managed persistence made domain object modeling unnecessarily complex and heavyweight. While container-managed persistence was originally conceived as an ease-of-use facility, in practice, it was awkward and limiting.

The purpose of the EJB 3.0 release was to refocus EJB on simplifying the developer's tasksand to fix all of these problems, and more.

One of the first steps in this process was evaluating the sources of complexity in the earlier EJB releases. This involved examining criticisms of EJB; understanding which EJB design patterns were really antipatterns; identifying APIs that were clumsy to use, were nonintuitive to newcomers to the technology, or could be dispensed with entirely; and recognizing other aspects of the technology that were obstacles to ease of use.

The preliminary list of what needed to be fixed together with a proposal for how the task could be approached formed the basis of JSR 220, the Java Community Process specification request with which I launched EJB 3.0. Starting with the initial list of the APIs that needed improvement, the EJB 3.0 Expert Group undertook the process of brainstorming on better, simpler constructs. Bill Burke, the chief architect of the JBoss application server and author of this book, was one of the key participants in this effort.

The Expert Group's work has resulted in a major simplification and improvement. All of the key EJB APIs are easier to use, and the configuration-by-exception approach of EJB 3.0 allows developers to rely on expected default behaviors. The XML deployment descriptor has become unnecessary, except for addressing more advanced cases.

The Java language metadata facility, newly added to Java SE, aided us in making these simplifications. EJB 3.0 uses metadata annotations to express within Java code the dependencies of EJB components upon container services, and thus to avoid the need to provide a deployment descriptor. Further, EJB 3.0 provides default values for metadata so that in general, this metadata can be sparseadj.稀少的, 稀疏的).

By using metadata annotations to designate environment dependencies and life cycle callbacks, EJB 3.0 has also been able to eliminate the requirement for the bean class to implement to the EnterpriseBean interfaces. A bean class can now selectively specify what it needs, and can implement only needed methods rather than unnecessary boilerplate code.

We were able to eliminate the earlier EJBHome factory patterns as well by requiring smarter interpositioning on the part of the container (transparently to the application) in creating references to components and their instances at the time of lookup or injection. Session beans can now be programmed as ordinary Java classes with ordinary business interfaces, rather than as heavyweight components.

These and other changes have greatly simplified the developer view. Further, they leave the underlying EJB architecture fundamentally unchanged, providing a migration path to EJB 3.0.

       The simplification of container-managed persistence provided a greater challenge. We began the effort here with the same steps as the simplification of session beans and message-driven beans: elimination of unneeded interfaces, use of annotations annotation for configuration information, and so on. It soon became clear, however, that EJB persistence needed a more radicaladj.根本的, 基本的, 激进的)transformation. Further, the success of lighter-weight object/relational mapping technologies such as Hibernate gave clear guidance to the direction that this transformation should take.

As described in this book, the resulting Java Persistence API replaces container-managed persistence with a lighter-weight, Plain Old Java Object (POJO) persistence layer. This layer provides extensive support for domain object modeling, including inheritance and polymorphism; numerous enhancements to the EJB QL query language to provide rich query capabilities; and a specification for portableadj.轻便的, 手提(), 便携式的)object/relational mapping through use of annotations or an XML descriptor. Persistent entities are now instances of ordinary (but managed) Java classes. As such, they can be created with new and passed to other application tiers as ordinary Java objects. The managed persistence contexts provided by the Java Persistence API provide particular leverage within EJB 3.0 environments, and enable the easy modeling of extended client "conversations."

Because of the scope of this work, EJB 3.0 has greatly simplified enterprise application development, and many of the features it has introduced have been incorporated elsewhere in the Java EE platform. Beyond this, the Java Persistence API has been expanded to support use "outside the container" in Java SE environments.

        Bill Burke's contributions to EJB 3.0 and the Java Persistence API have been numerous and far reaching. As chief architect for the JBoss application server, he brought to the EJB 3.0 Expert Group key insights on container innovations, extensive experience with the Hibernate object/relational persistence technology, and a broad perspective on the needs of developers and their use of the EJB technology in real-world applications. In this new edition of Enterprise JavaBeans, based on the earlier work by Richard Monson-Haefel, Bill Burke shares these insights together with his in-depth perspective on how these new, simplified EJB 3.0 APIs transform the enterprise Java landscape for application developers.

 
Linda DeMichiel
EJB 3.0 Architect and Specification Lead
Sun Microsystems
Santa Clara, California
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值