当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

《高级Web技术》参考资料:应用web - EJB 3RD EDITION - Richard Monson-Haefel

资源类别:文库,文档格式:PDF,文档页数:500,文件大小:2.45MB,团购合买
点击下载完整版文档(PDF)

EJB 3RD EDITION -Richard Monson-Haefel Authors?Note In the winter of 1997 I was working on a distributed object project using Java RMI. Not ingly, the project failed miserably because Java RMI didnt address performance, scalability, fail-over, security, and transactions; qualities of service that are so vital in a production environment. Although that lesson was not new for me-I had seen the same thing happen with CORBA-the timing of the project was especially interesting. It was at that same time Enterprise Javabeans first introduced by Sun Microsystems had Enterprise available earlier, that same project probably would have At the time I was working on that ill-fated Java RMI project, I was also writing a column for JavaReport Online called the"The Cutting Edge. The column covered what were then, new Java technologies like Java Naming and Directory Interface (NDI)and the JavaMail API. I was actually looking for a new topic for the edition of"The Cutting Edge, when I discovered the first public draft of Enterprise JavaBeans, version 0.8. I had first heard about this technology in 1996, but this was the first time anything public has been available. Having worked CORBA, Java RMI and other distributed object technologies, I knew a good thing when I saw it and immediately began writing an article about this new Enterprise JavaBeans". Although the article in question has long since been lost in the ether of the internet it was at that time the first article ever written on Enterprise JavaBeans That seems like eons ago. Since I published that article in March 1998, literally hundreds of articles have been written on Enterprise JavaBeans and several books have come and gone on the subject. Over the past three years this book has kept pace with three versions of the EJB specification and in its edition is considered by many, to my enormous satisfaction, to be the best book on Enterprise JavaBeans. As the newest version of the specification takes flight and a slew of new books on the subject day bew I cant help but remember the days when the words" Enterprise Java Beans"drew blank looks from just about everyone. I'm glad those days are over Copyright(c)2001 OReilly Associates

DRAFT, 10/21/017/6/2001 Copyright (c) 2001 O'Reilly & Associates 1 EJB 3RD EDITION - Richard Monson-Haefel Authors’ Note In the winter of 1997 I was working on a distributed object project using Java RMI. Not surprisingly, the project failed miserably because Java RMI didn’t address performance, scalability, fail-over, security, and transactions; qualities of service that are so vital in a production environment. Although that lesson was not new for me—I had seen the same thing happen with CORBA—the timing of the project was especially interesting. It was at that same time Enterprise JavaBeans was first introduced by Sun Microsystems – had Enterprise JavaBeans been available earlier, that same project probably would have succeeded. At the time I was working on that ill-fated Java RMI project, I was also writing a column for JavaReport Online called the “The Cutting Edge”. The column covered what were then, new Java technologies like Java Naming and Directory Interface (JNDI) and the JavaMail API. I was actually looking for a new topic for the 3rd edition of “The Cutting Edge”, when I discovered the first public draft of Enterprise JavaBeans, version 0.8. I had first heard about this technology in 1996, but this was the first time anything public has been available. Having worked on CORBA, Java RMI and other distributed object technologies, I knew a good thing when I saw it and immediately began writing an article about this new “Enterprise JavaBeans”. Although the article in question has long since been lost in the ether of the Internet, it was at that time the first article ever written on Enterprise JavaBeans. That seems like eons ago. Since I published that article in March 1998, literally hundreds of articles have been written on Enterprise JavaBeans and several books have come and gone on the subject. Over the past three years this book has kept pace with three versions of the EJB specification and in its 3rd edition is considered by many, to my enormous satisfaction, to be the best book on Enterprise JavaBeans. As the newest version of the specification takes flight and a slew of new books on the subject daybew I can’t help but remember the days when the words “Enterprise JavaBeans” drew blank looks from just about everyone. I’m glad those days are over

What Is Enterprise Java Beans? When JavaM was first introduced in the summer of 1995, most of the IT industry focused on its graphical user interface characteristics and the competitive advantage it offered in terms of distribution and platform independence. Those were interesting times. The Applet was king, and only a few of us were attempting to use it on the server side. I reality we spent about half our time coding and the other half trying to convince management that Java was not a Today, the focus has broadened considerably: Java has been recognized as an excellent platform for creating enterprise solutions, specifically for developing distributed server-side applications. This shift has much to do with Javas emerging role as a universal language for producing implementation-independent abstractions for common enterprise technologies. The JDBCTM API is the first and most familiar example JDBC provides a vendor-independent Java interface for accessing SQL relational databases. This abstraction has been so successful that it's difficult to find a relational database vendor that doesnt support JDBC Java abstractions for enterprise technologies have expanded considerably to include JNDI (Java Naming and Directory Interface M) for abstracting directory services, JTA (Java Transaction APD) for abstracting access to transaction managers, JMSTM (Java Messaging Service) for abstracting access to different message-oriented middleware products, and so on. Enterprise JavaBeansTM was first introduced as a draft specification in late 1997 and has since established itself as one of the most important Java enterprise technologies provided by Sun Microsystems. Enterprise JavaBeans (EJB) provides an abstraction for component transaction monitors (CTMs) Component transaction monitors represent the convergence of two technologies traditional transaction processing monitors, such as CICS, TUXEDO, and Encina, and distributed object services, such as CORBA(Common Object Request Broker Architecture), DCOM, and native Java RMI. Combining the best of both technologies, component transaction monitors provide a robust, component- based environment that simplifies distributed development while automatically managing the most complex aspects of enterprise computing, such as object brokering, transaction management, security, persistence, and concurrency Enterprise JavaBeans(EJB)defines a server-side component model that allows business objects to be developed and moved from one brand of EJB container to another. A component(an enterprise bean) presents a simple programming model that allows the developer to focus on its business purpose. An EJB server is responsible for making the component a distributed object and for managing services such as transactions, persistence, concurrency, and security. In addition to defining the beans business logic, the developer defines the beans runtime attributes in a way that is similar to choosing the display properties of visual widgets. The transactional, persis tence, and security behaviors of a component can be defined by choosing from a list of properties. The end result is Copyright(c)2001 OReilly Associates 2

DRAFT, 10/21/017/6/2001 Copyright (c) 2001 O'Reilly & Associates 2 What Is Enterprise JavaBeans? When Java™ was first introduced in the summer of 1995, most of the IT industry focused on its graphical user interface characteristics and the competitive advantage it offered in terms of distribution and platform independence. Those were interesting times. The Applet was king, and only a few of us were attempting to use it on the server side. I reality we spent about half our time coding and the other half trying to convince management that Java was not a fad. Today, the focus has broadened considerably: Java has been recognized as an excellent platform for creating enterprise solutions, specifically for developing distributed server-side applications. This shift has much to do with Java’s emerging role as a universal language for producing implementation-independent abstractions for common enterprise technologies. The JDBC™ API is the first and most familiar example. JDBC provides a vendor-independent Java interface for accessing SQL relational databases. This abstraction has been so successful that it’s difficult to find a relational database vendor that doesn’t support JDBC. Java abstractions for enterprise technologies have expanded considerably to include JNDI (Java Naming and Directory Interface™) for abstracting directory services, JTA (Java Transaction API) for abstracting access to transaction managers, JMS™ (Java Messaging Service) for abstracting access to different message-oriented middleware products, and so on. Enterprise JavaBeans™ was first introduced as a draft specification in late 1997 and has since established itself as one of the most important Java enterprise technologies provided by Sun Microsystems. Enterprise JavaBeans (EJB) provides an abstraction for component transaction monitors (CTMs). Component transaction monitors represent the convergence of two technologies: traditional transaction processing monitors, such as CICS, TUXEDO, and Encina, and distributed object services, such as CORBA (Common Object Request Broker Architecture), DCOM, and native Java RMI. Combining the best of both technologies, component transaction monitors provide a robust, component￾based environment that simplifies distributed development while automatically managing the most complex aspects of enterprise computing, such as object brokering, transaction management, security, persistence, and concurrency. Enterprise JavaBeans (EJB) defines a server-side component model that allows business objects to be developed and moved from one brand of EJB container to another. A component (an enterprise bean) presents a simple programming model that allows the developer to focus on its business purpose. An EJB server is responsible for making the component a distributed object and for managing services such as transactions, persistence, concurrency, and security. In addition to defining the bean’s business logic, the developer defines the bean’s runtime attributes in a way that is similar to choosing the display properties of visual widgets. The transactional, persistence, and security behaviors of a component can be defined by choosing from a list of properties. The end result is

that Enterprise JavaBeans makes developing distributed component systems that are managed in a robust transactional environment much easier For developers and corporate IT shops that have struggled with the complexities of delivering mission-critical, high-performance distributed systems using CORBA, DCOM,or Java RMI, Enterprise JavaBeans provides a far simpler and more productive platform on which to base development efforts When Enterprise JavaBeans 1.0 was finalized in 1998, it quickly become a de facto industry standard. Many vendors announced their support even before the ecification was finalized. Since that time Enterprise JavaBeans has been enhanced twice: The specification was first updated in 1999 to version 1. 1, which was covered by the 2 edition. The most recent revision to the specification version 2.0, is covered by this, the 3 edition of O'Reilly's eJB book. This 3 edition also covers EJB 1. 1, which is for the most part a subset of functionality offered by EJB 2.0 Products that conform to the EJB standard have come from every sector of the IT ndustry, including the TP monitor, CORBA ORB, application server, relational database, object database, and web server industries. Some of these products are based on proprietary models that have been adapted to EJB; many more wouldnt even exist without EJB In short, Enterprise JavaBeans 2.0 and 1.1 provides a standard distributed deployed on a different vendors EJB server. This book will provide you with the foundation you need to develop vendor-independent EJB solutions Who should read this book? his book explains and demonstrates the fundamentals of the Enterprise JavaBeans 2.0 and 1. I architecture. Although EJB makes distributed computin much simpler, it is still a complex technology that requires a great deal of time to master. This book provides a straightforward, no-nonsense explanation of the underlying technology, Java classes and interfaces, component model, and runtime behavior of Enterprise JavaBeans. It includes material that is backward compatible with EJB 1.1 and provides special notes and chapters when there are significant differences between 1. 1 and 2.0 Although this book focuses on the fundamentals. it's no "dummies book Enterprise JavaBeans embodies an extremely complex and ambitious enterprise technology. While using EJB may be fairly simple, the amount of work required to truly understand and master EJB is significant. Before reading this book, you should be fluent with the Java language and have some practical experience developing business solutions. Experience with distributed object systems is not a must, but you will need some experience with JDBC (or at least an Copyright(c)2001 OReilly Associates 3

DRAFT, 10/21/017/6/2001 Copyright (c) 2001 O'Reilly & Associates 3 that Enterprise JavaBeans makes developing distributed component systems that are managed in a robust transactional environment much easier. For developers and corporate IT shops that have struggled with the complexities of delivering mission-critical, high-performance distributed systems using CORBA, DCOM, or Java RMI, Enterprise JavaBeans provides a far simpler and more productive platform on which to base development efforts. When Enterprise JavaBeans 1.0 was finalized in 1998, it quickly become a de facto industry standard. Many vendors announced their support even before the specification was finalized. Since that time Enterprise JavaBeans has been enhanced twice: The specification was first updated in 1999 to version 1.1, which was covered by the 2nd edition. The most recent revision to the specification, version 2.0, is covered by this, the 3rd edition of O’Reilly’s EJB book. This 3rd edition also covers EJB 1.1, which is for the most part a subset of functionality offered by EJB 2.0. Products that conform to the EJB standard have come from every sector of the IT industry, including the TP monitor, CORBA ORB, application server, relational database, object database, and web server industries. Some of these products are based on proprietary models that have been adapted to EJB; many more wouldn’t even exist without EJB. In short, Enterprise JavaBeans 2.0 and 1.1 provides a standard distributed component model that greatly simplifies the development process and allows beans that are developed and deployed on one vendor’s EJB server to be easily deployed on a different vendor’s EJB server. This book will provide you with the foundation you need to develop vendor-independent EJB solutions. Who Should Read This Book? This book explains and demonstrates the fundamentals of the Enterprise JavaBeans 2.0 and 1.1 architecture. Although EJB makes distributed computing much simpler, it is still a complex technology that requires a great deal of time to master. This book provides a straightforward, no-nonsense explanation of the underlying technology, Java classes and interfaces, component model, and runtime behavior of Enterprise JavaBeans. It includes material that is backward compatible with EJB 1.1 and provides special notes and chapters when there are significant differences between 1.1 and 2.0. Although this book focuses on the fundamentals, it’s no “dummies” book. Enterprise JavaBeans embodies an extremely complex and ambitious enterprise technology. While using EJB may be fairly simple, the amount of work required to truly understand and master EJB is significant. Before reading this book, you should be fluent with the Java language and have some practical experience developing business solutions. Experience with distributed object systems is not a must, but you will need some experience with JDBC (or at least an

understanding of the basics) to follow the examples in this book. If you are unfamiliar with the Java language, I recommend that you pick up a copy of Learning Java M by Patrick Neimeyer and Jonathan Knudsen, formerly Exploring Java TM,(O'Reilly). If you are unfamiliar with JDBC, I recommend Database Programming with JDBCTM and Java TM ition by George Reese (OReilly). If you need a stronger background in distributed computing, I recommend Java M Distributed Computing by Jim Farley(O'Reilly) Organization Here's how the book is structured. The first three chapters are largely background material, placing Enterprise JavaBeans 2.0 and 1. 1 in the context of related technologies, and explaining at the most abstract level how the EJB technology works and what makes up an enterprise bean. Chapters 4 through 13 go into detail about developing enterprise beans of various types. Chapters 14 and 15 could be considered" advanced topics, except that transactions Chapter 14)are essential to everything that happens in enterprise computing, and design strategies( Chapter 15) help you deal with a number of real-world issues that influence bean design. Chapter 16 describes in detail the XML deployment descriptors used in EJB 2.0 and 1. 1. Finally, Chapter 17 is an overview of the JavaTM 2, Enterprise Edition(J2EE) includes Servlets, JSP and EJB Chapter 1, Introduction This chapter defines component transaction monitors and explains how they form the underlying technology of the Enterprise Java Beans component model Chapter 2, Architectural Overview This chapter defines the architecture of the Enterprise JavaBeans component model and examines the difference between the three basic types of enterprise beans: entity beans, session beans, and message-driven beans. Chapter 3, Resource Management and the Primary Services This chapter explains how the EJB-compliant server manages an enterprise Chapter 4, Developing Your First Enterprise Beans This chapter walks the reader through the development of some simple Chapter 5, The Client View This chapter explains in detail how enterprise beans are accessed and used by a remote client application Chapter 6, EJB 2.0 CMP: Basic Persistence This chapter provides an explanation of how to develop basic container managed entity beans in EJB 2.0 Copyright(c)2001 OReilly Associates

DRAFT, 10/21/017/6/2001 Copyright (c) 2001 O'Reilly & Associates 4 understanding of the basics) to follow the examples in this book. If you are unfamiliar with the Java language, I recommend that you pick up a copy of Learning Java™ by Patrick Neimeyer and Jonathan Knudsen, formerly Exploring Java™, (O’Reilly). If you are unfamiliar with JDBC, I recommend Database Programming with JDBC™ and Java™, 2nd Edition by George Reese (O’Reilly). If you need a stronger background in distributed computing, I recommend Java™ Distributed Computing by Jim Farley (O’Reilly). Organization Here’s how the book is structured. The first three chapters are largely background material, placing Enterprise JavaBeans 2.0 and 1.1 in the context of related technologies, and explaining at the most abstract level how the EJB technology works and what makes up an enterprise bean. Chapters 4 through 13 go into detail about developing enterprise beans of various types. Chapters 14 and 15 could be considered “advanced topics,” except that transactions (Chapter 14) are essential to everything that happens in enterprise computing, and design strategies (Chapter 15) help you deal with a number of real-world issues that influence bean design. Chapter 16 describes in detail the XML deployment descriptors used in EJB 2.0 and 1.1. Finally, Chapter 17 is an overview of the Java™ 2, Enterprise Edition (J2EE) includes Servlets, JSP and EJB. Chapter 1, Introduction This chapter defines component transaction monitors and explains how they form the underlying technology of the Enterprise JavaBeans component model. Chapter 2, Architectural Overview This chapter defines the architecture of the Enterprise JavaBeans component model and examines the difference between the three basic types of enterprise beans: entity beans, session beans, and message-driven beans. Chapter 3, Resource Management and the Primary Services This chapter explains how the EJB-compliant server manages an enterprise bean at runtime. Chapter 4, Developing Your First Enterprise Beans This chapter walks the reader through the development of some simple enterprise beans. Chapter 5, The Client View This chapter explains in detail how enterprise beans are accessed and used by a remote client application. Chapter 6, EJB 2.0 CMP: Basic Persistence This chapter provides an explanation of how to develop basic container￾managed entity beans in EJB 2.0

Chapter 7, EJB 2.0 CMP: Entity Relationships This chapter picks up where Chapter 6 left off, expanding your understanding of container-managed persistence to complex bean-to-bean relationships Chapter 8, EJB 2.0 CMP: EJB QL This chapter addresses the Enterprise JavaBeans Query Language(EJB QL), which is used to query EJBs and locate specific entity beans in EJB 2.0 Chapter 9, EJB 1.1: Container-Managed Persistence This chapter covers EJB 1. 1 container-managed persistence, which is supported in EJB 2.0 for backward compatibility. Read this chapter only if you need to support legacy EJB applications Chapter 10, Bean-Managed Persistence This chapter covers the development of bean-managed persistence beans including when to store, load, and remove data from the database Chapter 11, Entity-Container Contract This chapter covers the general protocol between an entity bean and its container at runtime and applies to container-managed persistence in EJB 2.0 and 1. 1, as well as bean-managed persistence Chapter 12, Session Beans This chapter shows how to develop stateless and stateful session beans Chapter 13, Message-Driven Beans This chapter shows how to develop message-driven beans in EJB 2.0 Chapter 14, Transactions This chapter provides an in-depth explanation of transactions and describes the transactional model defined by Enterprise JavaBeans Chapter 15, Design Strategies This chapter provides some basic design strategies that can simplify your EJB development efforts and make your EJB system more efficient. Chapter 16, XML Deployment Descriptors This chapter provides an in-depth explanation of the XML deployment descriptors used in EJB 1. I and 2.0 Chapter 17, Java 2, Enterprise Edition This chapter provides an overview of the Java 2, Enterprise Edition 1.3 and explains how 2.0 fits into this new platform. Appendix A, The Enterprise JavaBeans API This appendix provides a quick reference to the classes and interfaces defined in the EJB packag A ppendix B, State and Sequence Diagrams This appendix provides diagrams that clarify the life cycle of enterprise beans at runtime Appendix C, EJB Vendors This appendix provides information about the vendors of EJB servers Copyright(c)2001 OReilly Associates

DRAFT, 10/21/017/6/2001 Copyright (c) 2001 O'Reilly & Associates 5 Chapter 7, EJB 2.0 CMP: Entity Relationships This chapter picks up where Chapter 6 left off, expanding your understanding of container-managed persistence to complex bean-to-bean relationships Chapter 8, EJB 2.0 CMP: EJB QL This chapter addresses the Enterprise JavaBeans Query Language (EJB QL), which is used to query EJBs and locate specific entity beans in EJB 2.0 container-managed persistence. Chapter 9, EJB 1.1: Container-Managed Persistence This chapter covers EJB 1.1 container-managed persistence, which is supported in EJB 2.0 for backward compatibility. Read this chapter only if you need to support legacy EJB applications. Chapter 10, Bean-Managed Persistence This chapter covers the development of bean-managed persistence beans including when to store, load, and remove data from the database. Chapter 11, Entity-Container Contract This chapter covers the general protocol between an entity bean and its container at runtime and applies to container-managed persistence in EJB 2.0 and 1.1, as well as bean-managed persistence. Chapter 12, Session Beans This chapter shows how to develop stateless and stateful session beans. Chapter 13, Message-Driven Beans This chapter shows how to develop message-driven beans in EJB 2.0. Chapter 14, Transactions This chapter provides an in-depth explanation of transactions and describes the transactional model defined by Enterprise JavaBeans. Chapter 15, Design Strategies This chapter provides some basic design strategies that can simplify your EJB development efforts and make your EJB system more efficient. Chapter 16, XML Deployment Descriptors This chapter provides an in-depth explanation of the XML deployment descriptors used in EJB 1.1 and 2.0. Chapter 17, Java 2, Enterprise Edition This chapter provides an overview of the Java 2, Enterprise Edition 1.3 and explains how 2.0 fits into this new platform. Appendix A, The Enterprise JavaBeans API This appendix provides a quick reference to the classes and interfaces defined in the EJB packages. Appendix B, State and Sequence Diagrams This appendix provides diagrams that clarify the life cycle of enterprise beans at runtime. Appendix C, EJB Vendors This appendix provides information about the vendors of EJB servers

Software and versions This book covers Enterprise JavaBeans version 2.0 and version 1. 1, including all optional features. It uses Java language features from the Java 1.2 platform and JDBC. Because the focus of this book is to develop vendor-independent Enterprise JavaBeans components and solutions, I have stayed away from proprietary extensions and vendor-dependent idioms. Any EJB-compliant server can be used with this book; you should be familiar with that server's specific installation, deployment, and runtime management procedures to work with the examples This book covers both ejb 2.0 and ejb 1.1. These two versions have a lot in common, but when they differ, chapters, or text with in a chapter, that specific to each version is clearly marked. Feel free to skip version-specific sections that de not concern you. Unless indicated, the source code in this book has been written or both ejb 2. 0 and 1.1 Examples developed in this book are available from ftp:: /ftp oreilly. com/pub/examples/java/ejb. The examples are organized by Example Workbooks Although EJB applications themselves are portable, the manor in which you install and run EJB products vary wildly from one vendor to the next. For this reason its nearly impossible to cover all the ejb products available, so we have chosen a radical but very effective way to address these differences To help you deploy the book examples in different EJB products, the author will publish several free workbooks"which are used along with this book to run the examples on specific commercial and non-commerc servers. The workbook for a specific product will address that products most advanced server. So for example, if the vendor supports EJB 2.0, then the examples in the workbook will address EJB 2.0 features. If, on the other hand, the vendor only supports EJ then the examples in the workbook will be specific to EJB 1.1 Although there are plans to publish workbooks for as many different EJB server, at least two workbooks will be made available immediately. These workbooks free on-line in PDF format. The workbooks are all available at http://www.oreilly.com/catalog/entjbeans3/orhttp:/www.monson-haefel.com Copyright(c)2001 OReilly Associates 6

DRAFT, 10/21/017/6/2001 Copyright (c) 2001 O'Reilly & Associates 6 Software and Versions This book covers Enterprise JavaBeans version 2.0 and version 1.1, including all optional features. It uses Java language features from the Java 1.2 platform and JDBC. Because the focus of this book is to develop vendor-independent Enterprise JavaBeans components and solutions, I have stayed away from proprietary extensions and vendor- dependent idioms. Any EJB-compliant server can be used with this book; you should be familiar with that server’s specific installation, deployment, and runtime management procedures to work with the examples. This book covers both EJB 2.0 and EJB 1.1. These two versions have a lot in common, but when they differ, chapters, or text with in a chapter, that specific to each version is clearly marked. Feel free to skip version-specific sections that do not concern you. Unless indicated, the source code in this book has been written for both EJB 2.0 and 1.1 Examples developed in this book are available from ftp://ftp.oreilly.com/pub/examples/java/ejb. The examples are organized by chapter. Example Workbooks Although EJB applications themselves are portable, the manor in which you install and run EJB products vary wildly from one vendor to the next. For this reason its nearly impossible to cover all the EJB products available, so we have chosen a radical but very effective way to address these differences: Workbooks. To help you deploy the book examples in different EJB products, the author will publish several free “workbooks” which are used along with this book to run the examples on specific commercial and non-commercial EJB servers. The workbook for a specific product will address that products most advanced server. So for example, if the vendor supports EJB 2.0, then the examples in the workbook will address EJB 2.0 features. If, on the other hand, the vendor only supports EJB 1.1, then the examples in the workbook will be specific to EJB 1.1. Although there are plans to publish workbooks for as many different EJB server, at least two workbooks will be made available immediately. These workbooks are free on-line in PDF format. The workbooks are all available at http://www.oreilly.com/catalog/entjbeans3/ or http://www.monson-haefel.com

Conventions Italic is used for Filenames and pat stnames. domain names. URLS and email addresses v terms where they are defined th is used for Code examples and fragments Class, variable, and method names, and Java keywords used within the text SQL commands, table names, and column names XML elements and tags Constant width bold is used for emphasis in some code examples Constant width italic is used to indicate text that is replaceable. For example, in BeanNamePK, you would replace BeanName with a specific bean An Enterprise JavaBean consists of many parts; it's not a single object, but a collection of objects and interfaces. To refer to an Enterprise Java Bean as a whole, we use the name of its business name in Roman type followed by the acronym, EJB(Enterprise JavaBean). For example, we will refer to the Customer EJB when we want to talk about the enterprise bean in general. If we put the name in a constant width font, we are referring explicitly to the beans the interface. So Customerremote is the remote interface that define business methods of the customer ejb Comments and Questions Please address comments and questions concerning this book to the publisher O'Reilly Associates, Inc 101 Morris Street Sebastopol, CA 95472 (800)998-9938(in the U.S. or Canada) (707)8290104(fax) You can also send us messages electronically. To be put on our mailing Copyright(c)2001 OReilly Associates 7

DRAFT, 10/21/017/6/2001 Copyright (c) 2001 O'Reilly & Associates 7 Conventions Italic is used for: · Filenames and pathnames · Hostnames, domain names, URLs, and email addresses · New terms where they are defined Constant width is used for: · Code examples and fragments · Class, variable, and method names, and Java keywords used within the text · SQL commands, table names, and column names · XML elements and tags Constant width bold is used for emphasis in some code examples. Constant width italic is used to indicate text that is replaceable. For example, in BeanNamePK, you would replace BeanName with a specific bean name. An Enterprise JavaBean consists of many parts; it’s not a single object, but a collection of objects and interfaces. To refer to an Enterprise JavaBean as a whole, we use the name of its business name in Roman type followed by the acronym, EJB (Enterprise JavaBean). For example, we will refer to the Customer EJB when we want to talk about the enterprise bean in general. If we put the name in a constant width font, we are referring explicitly to the bean’s remote interface. So CustomerRemote is the remote interface that defines the business methods of the Customer EJB. Comments and Questions Please address comments and questions concerning this book to the publisher: O’Reilly & Associates, Inc. 101 Morris Street Sebastopol, CA 95472 (800) 998-9938 (in the U.S. or Canada) (707) 829-0515 (international or local) (707) 829-0104 (fax) You can also send us messages electronically. To be put on our mailing list or to request a catalog, send email to:

To ask technical questions or comment on the book, send email to bookquestions@oreilly. a web site for the book, where we'll list errata and any plans for future ditions. You can access this page at For more information about this book and others, see the O Reilly web site at http://www.oreilly.com/ The author maintains a web site for the discussion of ejb and related distributed computingtechnologies(http://www.ejbnow.com).EjbNow.coMprovidesnews about this book as well as code tips, articles, and an extensive list of links to EJB resources Acknowledgments While there is only one name on the cover of this book, the credit for development and delivery is shared by many individuals. Michael Loukides, my editor, was pivotal to the success of every edition of this book. Without his experience, craft, and guidance, this book would not have been possible Many expert technical reviewers helped ensure that the material was technically accurate and true to the spirit of Enterprise JavaBeans. Of special note are David Chappell of David Chappell Associates, Jim Farley, author of Java TM Distributed Computing(O'Reilly, 1998), Greg Nyberg of ObjectPartners, Prasad Muppirala and Shannon Pieper of BORN Information Services, contributed greatly to the technical accuracy of this book and brought a combination of industry and real-world experience to bear, helping to make this one of the best books on Enterprise Java Beans published today. Special thanks also go to Sriram Srinivasan of BEA, Anne Thomas of Sun MicrosystemsandlanmCcallionofIbmHursley,TimRohalyofjgUru.com, James D. Frentress of ITM Corp, Andrzej Jan Taramina of Accredo Systems Marc Loy, co-author of JavaTM Swing(O Reilly, 1998), Don Weiss of Step 1 Mike Slinn of The Dialog Corporation, and Kevin Dick of Kevin Dick Associates. The contributions of these technical experts were critical to the echnical and conceptual accuracy of earlier editions of this book. Others I would like to thank include Maggie Mezquita, Greg Hartzel, John Klug and Jon Jamsa of bORN Information who all suffered though the first draft of the first edition long ago to provide valuable feedback. Thanks also to Vlad Matena and Mark Hapner of Sun Microsystems, the primary architects of Enterprise JavaBeans; Linda DeMichiel, EJB 2.0 specification lead Copyright(c)2001 OReilly Associates 8

DRAFT, 10/21/017/6/2001 Copyright (c) 2001 O'Reilly & Associates 8 info@oreilly.com To ask technical questions or comment on the book, send email to: bookquestions@oreilly.com We have a web site for the book, where we’ll list errata and any plans for future editions. You can access this page at: http://www.oreilly.com/catalog/entjbeans2/ For more information about this book and others, see the O’Reilly web site at: http://www.oreilly.com/ The author maintains a web site for the discussion of EJB and related distributed computing technologies (http://www.ejbnow.com). EJBNow.com provides news about this book as well as code tips, articles, and an extensive list of links to EJB resources. Acknowledgments While there is only one name on the cover of this book, the credit for its development and delivery is shared by many individuals. Michael Loukides, my editor, was pivotal to the success of every edition of this book. Without his experience, craft, and guidance, this book would not have been possible. Many expert technical reviewers helped ensure that the material was technically accurate and true to the spirit of Enterprise JavaBeans. Of special note are David Chappell of David Chappell & Associates, Jim Farley, author of Java™ Distributed Computing (O’Reilly, 1998), Greg Nyberg of ObjectPartners, Prasad Muppirala and Shannon Pieper of BORN Information Services, …………. They contributed greatly to the technical accuracy of this book and brought a combination of industry and real-world experience to bear, helping to make this one of the best books on Enterprise JavaBeans published today. Special thanks also go to Sriram Srinivasan of BEA, Anne Thomas of Sun Microsystems, and Ian McCallion of IBM Hursley, Tim Rohaly of jGuru.com, James D. Frentress of ITM Corp., Andrzej Jan Taramina of Accredo Systems, Marc Loy, co-author of Java™ Swing (O’Reilly, 1998), Don Weiss of Step 1, Mike Slinn of The Dialog Corporation, and Kevin Dick of Kevin Dick & Associates. The contributions of these technical experts were critical to the technical and conceptual accuracy of earlier editions of this book. Others I would like to thank include Maggie Mezquita, Greg Hartzel, John Klug and Jon Jamsa of BORN Information who all suffered though the first draft of the first edition so long ago to provide valuable feedback. Thanks also to Vlad Matena and Mark Hapner of Sun Microsystems, the primary architects of Enterprise JavaBeans; Linda DeMichiel, EJB 2.0 specification lead;

and Bonnie Kellett J2EE Program Manager - they were all willing to answer several of my most complex questions. Thanks to all the participants in the EJB INTEREST mailing list hosted by Sun Microsystems for their interesting and sometimes controversial, but always informative, postings over the past four Finally, the most sincere gratitude must be extended to my wife, Hollie, for supporting and assisting me through three years of painstaking research and writing which were required to produce three editions of this book. Without her unfailing support and love, this book would not have been completed Copyright(c)2001 OReilly Associates

DRAFT, 10/21/017/6/2001 Copyright (c) 2001 O'Reilly & Associates 9 and Bonnie Kellett J2EE Program Manager – they were all willing to answer several of my most complex questions. Thanks to all the participants in the EJB￾INTEREST mailing list hosted by Sun Microsystems for their interesting and sometimes controversial, but always informative, postings over the past four years. Finally, the most sincere gratitude must be extended to my wife, Hollie, for supporting and assisting me through three years of painstaking research and writing which were required to produce three editions of this book. Without her unfailing support and love, this book would not have been completed

Introduction This book is about Enterprise JavaBeans 1. I and 2.0 the second and third versions of the Enterprise JavaBeans specification. Just as the Java platform has revolutionized the way we think about software development, Enterprise Java Beans has revolutionized the way we think about developing mission-critical enterprise software. It combines server-side components with distributed object technologies and asynchronous messaging to greatly simplify the task of application development. It automatically takes into account many of the requirements of business systems: security, resource pooling, persistence concurrency, and transactional integrity This book shows you how to use Enterprise JavaBeans to develop scalable, portable business systems. But before we can start talking about EJB itself, we'll need a brief introduction to the technologies addressed by EJB, such as component models distributed objects, component transaction monitors (CTMs), and asynchronous essaging. It's particularly important to have a basic understanding of component transaction monitors, the technology that lies beneath EJB. In Chapters 2 and 3, we'll start looking at EJB itself and see how enterprise beans are put together. The rest of this book is devoted to developing enterprise beans for an imaginary business and dis cussing advanced issues It is assumed that you' re already familiar with Java; if you're not, Exploring Java TM by Patrick Niemeyer and Josh Peck is an excellent introduction. This book also assumes that Copyright(c)2001 OReilly Associates

DRAFT 10/21/0107/06/01 Copyright (c) 2001 O'Reilly & Associates 1 Introduction This book is about Enterprise JavaBeans 1.1 and 2.0 the second and third versions of the Enterprise JavaBeans specification. Just as the Java platform has revolutionized the way we think about software development, Enterprise JavaBeans has revolutionized the way we think about developing mission-critical enterprise software. It combines server-side components with distributed object technologies and asynchronous messaging to greatly simplify the task of application development. It automatically takes into account many of the requirements of business systems: security, resource pooling, persistence, concurrency, and transactional integrity. This book shows you how to use Enterprise JavaBeans to develop scalable, portable business systems. But before we can start talking about EJB itself, we’ll need a brief introduction to the technologies addressed by EJB, such as component models, distributed objects, component transaction monitors (CTMs), and asynchronous messaging. It’s particularly important to have a basic understanding of component transaction monitors, the technology that lies beneath EJB. In Chapters 2 and 3, we’ll start looking at EJB itself and see how enterprise beans are put together. The rest of this book is devoted to developing enterprise beans for an imaginary business and dis cussing advanced issues. It is assumed that you’re already familiar with Java; if you’re not, Exploring Java™ by Patrick Niemeyer and Josh Peck is an excellent introduction. This book also assumes that

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共500页,可试读40页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有