Enterprise JavaBeans 3.0. 5th Edition - Helion
ISBN: 978-05-965-5507-8
stron: 768, Format: ebook
Data wydania: 2006-05-16
Księgarnia: Helion
Cena książki: 143,65 zł (poprzednio: 167,03 zł)
Oszczędzasz: 14% (-23,38 zł)
If you're up on the latest Java technologies, then you know that Enterprise JavaBeans (EJB) 3.0 is the hottest news in Java this year. In fact, EJB 3.0 is being hailed as the new standard of server-side business logic programming. And O'Reilly's award-winning book on EJB has been refreshed just in time to capitalize on the technology's latest rise in popularity.
This fifth edition, written by Bill Burke and Richard Monson-Haefel, has been updated to capture the very latest need-to-know Java technologies in the same award-winning fashion that drove the success of the previous four strong-selling editions. Bill Burke, Chief Architect at JBoss, Inc., represents the company on the EJB 3.0 and Java EE 5 specification committees. Richard Monson-Haefel is one of the world's leading experts on Enterprise Java.
Enterprise JavaBeans 3.0, 5th Edition is organized into two parts: the technical manuscript followed by the JBoss workbook. The technical manuscript explains what EJB is, how it works, and when to use it. The JBoss workbook provides step-by-step instructions for installing, configuring, and running the examples from the manuscript on the JBoss 4.0 Application Server.
Although EJB makes application development much simpler, it's still a complex and ambitious technology that requires a great deal of time to study and master. But now, thanks to Enterprise JavaBeans 3.0, 5th Edition, you can overcome the complexities of EJBs and learn from hundreds of practical examples that are largeenough to test key concepts but small enough to be taken apart and explained in the detail that you need. Now you can harness the complexity of EJB with just a single resource by your side.
Osoby które kupowały "Enterprise JavaBeans 3.0. 5th Edition", wybierały także:
- Metoda dziel i zwyci 89,00 zł, (26,70 zł -70%)
- Język C. Kurs video. Praktyczne wprowadzenie do programowania 99,00 zł, (29,70 zł -70%)
- Wprowadzenie do Javy. Programowanie i struktury danych. Wydanie XII 193,23 zł, (59,90 zł -69%)
- Spring i Spring Boot. Kurs video. Testowanie aplikacji i bezpiecze 125,42 zł, (45,15 zł -64%)
- Maven. Kurs video. Automatyzacja tworzenia aplikacji w Javie 98,98 zł, (39,59 zł -60%)
Spis treści
Enterprise JavaBeans 3.0. 5th Edition eBook -- spis treści
- Enterprise JavaBeans 3.0, 5th Edition
- SPECIAL OFFER: Upgrade this ebook with OReilly
- A Note Regarding Supplemental Files
- Foreword
- Preface
- Authors Note
- Who Should Read This Book
- How This Book Is Organized
- Part I: The EJB 3.0 Standard
- Part II: The JBoss Workbook
- Software and Versions
- Conventions Used in This Book
- Using Code Examples
- Safari Enabled
- Comments and Questions
- Acknowledgments
- I. The EJB 3.0 Standard
- 1. Introduction
- 1.1. Server-Side Components
- 1.1.1. Enterprise JavaBeans Defined
- 1.2. Persistence and Entity Beans
- 1.3. Asynchronous Messaging
- 1.3.1. Java Message Service
- 1.3.2. Message-Driven Beans and JCA 1.5
- 1.4. Web Services
- 1.5. Titan Cruises: An Imaginary Business
- 1.6. What's Next?
- 1.1. Server-Side Components
- 2. Architectural Overview
- 2.1. The Entity Bean
- 2.1.1. The Entity Bean Class
- 2.1.2. XML Deployment Descriptors and JAR Files
- 2.2. The Enterprise Bean Component
- 2.2.1. Classes and Interfaces
- 2.2.1.1. Naming conventions
- 2.2.1.2. The remote interface
- 2.2.1.3. The bean class
- 2.2.1.4. What about message-driven beans?
- 2.2.2. Annotations, Deployment Descriptors, and JAR Files
- 2.2.3. The EJB Container
- 2.2.3.1. The proxy stub, EJB container, and bean instance
- 2.2.1. Classes and Interfaces
- 2.3. Using Enterprise and Entity Beans
- 2.3.1. Modeling Taskflow with Session Beans
- 2.3.1.1. Stateful and statelessl session beans
- 2.3.2. Message-Driven Beans
- 2.3.1. Modeling Taskflow with Session Beans
- 2.4. The Bean-Container Contract
- 2.5. Summary
- 2.1. The Entity Bean
- 3. Resource Management and Primary Services
- 3.1. Resource Management
- 3.1.1. Instance Pooling
- 3.1.1.1. The stateless session bean life cycle
- 3.1.1.2. Message-driven beans and instance pooling
- 3.1.2. The Activation Mechanism
- 3.1.3. Java EE Connector Architecture
- 3.1.3.1. Java EE Connectors 1.5
- 3.1.1. Instance Pooling
- 3.2. Primary Services
- 3.2.1. Concurrency
- 3.2.1.1. Concurrency with session and entity beans
- 3.2.1.2. Concurrency with message-driven beans
- 3.2.2. Transactions
- 3.2.3. Persistence
- 3.2.3.1. Java Persistence
- 3.2.3.2. Object-to-relational persistence
- 3.2.4. Distributed Objects
- 3.2.5. Asynchronous Enterprise Messaging
- 3.2.6. EJB Timer Service
- 3.2.7. Naming
- 3.2.8. Security
- 3.2.9. Primary Services and Interoperability
- 3.2.9.1. IIOP
- 3.2.9.2. SOAP and WSDL
- 3.2.1. Concurrency
- 3.3. What's Next?
- 3.1. Resource Management
- 4. Developing Your First Beans
- 4.1. Developing an Entity Bean
- 4.1.1. Cabin: The Bean Class
- 4.1.2. The persistence.xml File
- 4.2. Developing a Session Bean
- 4.2.1. TravelAgentRemote: The Remote Interface
- 4.2.2. TravelAgentBean: The Bean Class
- 4.2.3. titan.jar: The JAR File
- 4.2.4. Creating a CABIN Table in the Database
- 4.2.5. Deploying the EJB JAR
- 4.2.6. Creating a Client Application
- 4.2.6.1. Creating a new Cabin entity
- 4.1. Developing an Entity Bean
- 5. Persistence: EntityManager
- 5.1. Entities Are POJOs
- 5.2. Managed Versus Unmanaged Entities
- 5.2.1. Persistence Context
- 5.2.1.1. Transaction-scoped persistence context
- 5.2.1.2. Extended persistence context
- 5.2.1.3. Detached entities
- 5.2.1. Persistence Context
- 5.3. Packaging a Persistence Unit
- 5.3.1. The Persistence Unit Class Set
- 5.4. Obtaining an EntityManager
- 5.4.1. EntityManagerFactory
- 5.4.1.1. Getting an EntityManagerFactory in Java SE
- 5.4.1.2. Getting an EntityManagerFactory in Java EE
- 5.4.2. Obtaining a Persistence Context
- 5.4.1. EntityManagerFactory
- 5.5. Interacting with an EntityManager
- 5.5.1. Persisting Entities
- 5.5.2. Finding Entities
- 5.5.2.1. find( ) and getReference( )
- 5.5.2.2. Queries
- 5.5.3. Updating Entities
- 5.5.4. Merging Entities
- 5.5.5. Removing Entities
- 5.5.6. refresh( )
- 5.5.7. contains( ) and clear( )
- 5.5.8. flush( ) and FlushModeType
- 5.5.9. Locking
- 5.5.10. getDelegate( )
- 5.6. Resource Local Transactions
- 6. Mapping Persistent Objects
- 6.1. The Programming Model
- 6.1.1. The Customer Bean
- 6.1.2. The Bean Class
- 6.1.3. XML Mapping File
- 6.2. Basic Relational Mapping
- 6.2.1. Elementary Schema Mappings
- 6.2.1.1. @Table
- 6.2.1.2. @Column
- 6.2.1.3. XML
- 6.2.1. Elementary Schema Mappings
- 6.3. Primary Keys
- 6.3.1. @Id
- 6.3.2. Table Generators
- 6.3.3. Sequence Generators
- 6.3.4. Primary-Key Classes and Composite Keys
- 6.3.4.1. @IdClass
- 6.3.4.2. @EmbeddedId
- 6.4. Property Mappings
- 6.4.1. @Transient
- 6.4.2. @Basic and FetchType
- 6.4.3. @Temporal
- 6.4.4. @Lob
- 6.4.5. @Enumerated
- 6.5. Multitable Mappings with @SecondaryTable
- 6.6. @Embedded Objects
- 6.1. The Programming Model
- 7. Entity Relationships
- 7.1. The Seven Relationship Types
- 7.1.1. One-to-One Unidirectional Relationship
- 7.1.1.1. Relational database schema
- 7.1.1.2. Programming model
- 7.1.1.3. Primary-key join columns
- 7.1.1.4. One-to-one unidirectional XML mapping
- 7.1.1.5. Default relationship mapping
- 7.1.2. One-to-One Bidirectional Relationship
- 7.1.2.1. Relational database schema
- 7.1.2.2. One-to-one bidirectional XML mapping
- 7.1.2.3. Default relationship mapping
- 7.1.3. One-to-Many Unidirectional Relationship
- 7.1.3.1. Relational database schema
- 7.1.3.2. Programming model
- 7.1.3.3. One-to-many unidirectional XML mapping
- 7.1.3.4. Join table mapping
- 7.1.3.5. One-to-many unidirectional join table XML mapping
- 7.1.3.6. Default relationship mapping
- 7.1.4. The Cruise, Ship, and Reservation Entities
- 7.1.5. Many-to-One Unidirectional Relationship
- 7.1.5.1. Relational database schema
- 7.1.5.2. Programming model
- 7.1.5.3. Many-to-one unidirectional XML mapping
- 7.1.5.4. Default relationship mapping
- 7.1.6. One-to-Many Bidirectional Relationship
- 7.1.6.1. Relational database schema
- 7.1.6.2. Programming model
- 7.1.6.3. One-to-many bidirectional XML mapping
- 7.1.6.4. Default relationship mapping
- 7.1.7. Many-to-Many Bidirectional Relationship
- 7.1.7.1. Relational database schema
- 7.1.7.2. Programming model
- 7.1.7.3. Many-to-many bidirectional XML mapping
- 7.1.7.4. Default Rrelationship mapping
- 7.1.8. Many-to-Many Unidirectional Relationship
- 7.1.8.1. Relational database schema
- 7.1.8.2. Programming model
- 7.1.8.3. Many-to-many unidirectional XML mapping
- 7.1.8.4. Default relationship mapping
- 7.1.1. One-to-One Unidirectional Relationship
- 7.2. Mapping Collection-Based Relationships
- 7.2.1. Ordered List-Based Relationship
- 7.2.1.1. List XML mapping
- 7.2.2. Map-Based Relationship
- 7.2.2.1. Map XML mapping
- 7.2.1. Ordered List-Based Relationship
- 7.3. Detached Entities and FetchType
- 7.4. Cascading
- 7.4.1. PERSIST
- 7.4.2. MERGE
- 7.4.3. REMOVE
- 7.4.4. REFRESH
- 7.4.5. ALL
- 7.4.6. When to Use Cascading
- 7.1. The Seven Relationship Types
- 8. Entity Inheritance
- 8.1. Single Table per Class Hierarchy
- 8.1.1. Advantages
- 8.1.2. Disadvantages
- 8.2. Table per Concrete Class
- 8.2.1. Advantages
- 8.2.2. Disadvantages
- 8.3. Table per Subclass
- 8.3.1. Advantages
- 8.3.2. Disadvantages
- 8.4. Mixing Strategies
- 8.5. Nonentity Base Classes
- 8.1. Single Table per Class Hierarchy
- 9. Queries and EJB QL
- 9.1. Query API
- 9.1.1. Parameters
- 9.1.2. Date Parameters
- 9.1.3. Paging Results
- 9.1.4. Hints
- 9.1.5. FlushMode
- 9.2. EJB QL
- 9.2.1. Abstract Schema Names
- 9.2.2. Simple Queries
- 9.2.3. Selecting Entity and Relationship Properties
- 9.2.4. Constructor Expressions
- 9.2.5. The IN Operator and INNER JOIN
- 9.2.6. LEFT JOIN
- 9.2.7. Fetch Joins
- 9.2.8. Using DISTINCT
- 9.2.9. The WHERE Clause and Literals
- 9.2.10. The WHERE Clause and Operator Precedence
- 9.2.11. The WHERE Clause and Arithmetic Operators
- 9.2.12. The WHERE Clause and Logical Operators
- 9.2.13. The WHERE Clause and Comparison Symbols
- 9.2.14. The WHERE Clause and Equality Semantics
- 9.2.15. The WHERE Clause and BETWEEN
- 9.2.16. The WHERE Clause and IN
- 9.2.17. The WHERE Clause and IS NULL
- 9.2.18. The WHERE Clause and IS EMPTY
- 9.2.19. The WHERE Clause and MEMBER OF
- 9.2.20. The WHERE Clause and LIKE
- 9.2.21. Functional Expressions
- 9.2.21.1. Functional expressions in the WHERE clause
- 9.2.21.2. Functions returning dates and times
- 9.2.21.3. Aggregate functions in the SELECT clause
- 9.2.21.3.1. COUNT (identifier or path expression)
- 9.2.21.3.2. MAX( path expression), MIN( path expression)
- 9.2.21.3.3. AVG( numeric ), SUM( numeric)
- 9.2.21.3.4. DISTINCT, nulls, and empty arguments
- 9.2.22. The ORDER BY Clause
- 9.2.23. GROUP BY and HAVING
- 9.2.24. Subqueries
- 9.2.24.1. ALL, ANY, SOME
- 9.2.24.2. EXISTS
- 9.2.25. Bulk UPDATE and DELETE
- 9.3. Native Queries
- 9.3.1. Scalar Native Queries
- 9.3.2. Simple Entity Native Queries
- 9.3.3. Complex Native Queries
- 9.3.3.1. Native queries with multiple entities
- 9.3.3.2. Mixed scalar and entity results
- 9.4. Named Queries
- 9.4.1. Named Native Queries
- 9.1. Query API
- 10. Entity Callbacks and Listeners
- 10.1. Callback Events
- 10.2. Callbacks on Entity Classes
- 10.3. Entity Listeners
- 10.3.1. Default Entity Listeners
- 10.3.2. Inheritance and Listeners
- 11. Session Beans
- 11.1. The Stateless Session Bean
- 11.1.1. The ProcessPayment EJB
- 11.1.1.1. The database table: PAYMENT
- 11.1.1.2. The business interface: ProcessPayment
- 11.1.1.3. Entities as parameters
- 11.1.1.4. Domain objects: the CreditCardDO and CheckDO classes
- 11.1.1.5. An application exception: PaymentException
- 11.1.1.6. The bean class: ProcessPaymentBean
- 11.1.1.7. Accessing environment properties (injection)
- 11.1.2. The XML Deployment Descriptor
- 11.1.1. The ProcessPayment EJB
- 11.2. SessionContext
- 11.2.1. EJBContext
- 11.3. The Life Cycle of a Stateless Session Bean
- 11.3.1. The Does Not Exist State
- 11.3.2. The Method-Ready Pool
- 11.3.2.1. Transitioning to the Method-Ready Pool
- 11.3.2.2. Life in the Method-Ready Pool
- 11.3.2.3. Transitioning out of the Method-Ready Pool: the death of a stateless bean instance
- 11.4. The Stateful Session Bean
- 11.4.1. Getting Set Up for the TravelAgent EJB
- 11.4.2. The TravelAgent EJB
- 11.4.2.1. The remote interface: TravelAgent
- 11.4.2.2. Domain objects: the TicketDO class
- 11.4.2.3. Taking a peek at the client view
- 11.4.2.4. The bean class: TravelAgentBean
- 11.4.2.5. The bookPassage( ) method
- 11.4.2.6. The XML Deployment Descriptor
- 11.5. The Life Cycle of a Stateful Session Bean
- 11.5.1. The Does Not Exist State
- 11.5.2. The Method-Ready State
- 11.5.2.1. Transitioning into the Method-Ready state
- 11.5.2.2. Life in the Method-Ready state
- 11.5.2.3. Transitioning out of the Method-Ready state
- 11.5.3. The Passivated State
- 11.5.3.1. System exceptions
- 11.6. Stateful Session Beans and Extended Persistence Contexts
- 11.7. Nested Stateful Session Beans
- 11.1. The Stateless Session Bean
- 12. Message-Driven Beans
- 12.1. JMS and Message-Driven Beans
- 12.1.1. JMS as a Resource
- 12.1.1.1. Reimplementing the TravelAgent EJB with JMS
- 12.1.1.2. ConnectionFactory and Topic
- 12.1.1.3. Connection and Session
- 12.1.1.4. MessageProducer
- 12.1.1.5. Message types
- 12.1.2. JMS Application Client
- 12.1.3. JMS Is Asynchronous
- 12.1.4. JMS Messaging Models
- 12.1.4.1. Publish-and-subscribe
- 12.1.4.2. Point-to-point
- 12.1.4.3. Which messaging model should you use?
- 12.1.5. Session Beans Should Not Receive Messages
- 12.1.6. Learning More About JMS
- 12.1.1. JMS as a Resource
- 12.2. JMS-Based Message-Driven Beans
- 12.2.1. The ReservationProcessor EJB
- 12.2.2. The ReservationProcessorBean Class
- 12.2.2.1. MessageDrivenContext
- 12.2.2.2. MessageListener interface
- 12.2.2.3. Taskflow and integration for B2B: onMessage( )
- 12.2.2.4. Sending messages from a message-driven bean
- 12.2.3. @MessageDriven
- 12.2.3.1. @ActivationConfigProperty
- 12.2.3.2. Message selector
- 12.2.3.3. Acknowledge mode
- 12.2.3.4. Subscription durability
- 12.2.4. The XML Deployment Descriptor
- 12.2.5. The ReservationProcessor Clients
- 12.2.5.1. The reservation message producer
- 12.2.5.2. The ticket message consumer
- 12.3. The Life Cycle of a Message-Driven Bean
- 12.3.1. The Does Not Exist State
- 12.3.2. The Method-Ready Pool
- 12.3.2.1. Transitioning to the Method-Ready Pool
- 12.3.2.2. Life in the Method-Ready Pool
- 12.3.2.3. Transitioning out of the Method-Ready Pool: the death of an MDB instance
- 12.4. Connector-Based Message-Driven Beans
- 12.5. Message Linking
- 12.1. JMS and Message-Driven Beans
- 13. Timer Service
- 13.1. Titan's Maintenance Timer
- 13.2. Timer Service API
- 13.2.1. The TimerService Interface
- 13.2.1.1. Exceptions
- 13.2.2. The Timer
- 13.2.2.1. Canceling timers
- 13.2.2.2. Identifying timers
- 13.2.2.3. Retrieving other information from timers
- 13.2.2.4. The TimerHandle object
- 13.2.2.5. Exceptions
- 13.2.1. The TimerService Interface
- 13.3. Transactions
- 13.4. Stateless Session Bean Timers
- 13.5. Message-Driven Bean Timers
- 13.5.1. Problems with the Timer Service
- 13.5.1.1. A very little bit about cron
- 13.5.1.2. Improving the Timer Service
- 13.5.1.3. Message-driven beans: standard configuration properties
- 13.5.1.4. Other problems with the Timer API
- 13.5.1. Problems with the Timer Service
- 13.6. Final Words
- 14. The JNDI ENC and Injection
- 14.1. The JNDI ENC
- 14.1.1. What Can Be Registered in the JNDI ENC?
- 14.1.2. How Is the JNDI ENC Populated?
- 14.1.3. XML Population
- 14.1.4. Annotation Population
- 14.1.5. How Are Things Referenced from the ENC?
- 14.1.5.1. Using EJBContext
- 14.1.5.2. Annotation injection
- 14.1.5.3. Default ENC name
- 14.1.5.4. XML injection
- 14.1.5.5. XML overrides
- 14.1.5.6. Injection and inheritance
- 14.2. Reference and Injection Types
- 14.2.1. EJB References
- 14.2.1.1. @javax.ejb.EJB
- 14.2.1.2. XML-based remote EJB references
- 14.2.1.3. XML-based local EJB references
- 14.2.1.4. Ambiguous and overloaded EJB names
- 14.2.1.5. Resolving EJB references
- 14.2.2. EntityManagerFactory References
- 14.2.2.1. @javax.persistence.PersistenceUnit
- 14.2.2.2. XML-based EntityManagerFactory references
- 14.2.2.3. Scoped and overloaded unit names
- 14.2.3. EntityManager References
- 14.2.3.1. @javax.persistence.PersistenceContext
- 14.2.3.2. XML-based EntityManager references
- 14.2.3.3. Scoped and overloaded unit names
- 14.2.4. Resource References
- 14.2.4.1. @javax.annotation.Resource
- 14.2.4.2. Shareable resources
- 14.2.4.3. XML-based resource references
- 14.2.5. Resource Environment and Administered Objects
- 14.2.6. Environment Entries
- 14.2.7. Message Destination References
- 14.2.7.1. XML-based resource references
- 14.2.7.2. Using @Resource
- 14.2.8. Web Service References
- 14.2.8.1. XML-based resource references
- 14.2.8.2. Using @javax.xml.ws.WebServiceRef
- 14.2.1. EJB References
- 14.1. The JNDI ENC
- 15. Interceptors
- 15.1. Intercepting Methods
- 15.1.1. Interceptor Class
- 15.1.2. Applying Interceptors
- 15.1.2.1. Annotated methods and classes
- 15.1.2.2. Applying interceptors through XML
- 15.1.2.3. Default interceptors
- 15.1.2.4. Disabling interceptors
- 15.2. Interceptors and Injection
- 15.2.1. XML Injection
- 15.3. Intercepting Life Cycle Events
- 15.3.1. Custom Injection Annotations
- 15.4. Exception Handling
- 15.4.1. Aborting a Method Invocation
- 15.4.2. Catch and Rethrow Exceptions
- 15.5. Interceptor Life Cycle
- 15.6. Bean Class @AroundInvoke Methods
- 15.7. Future Interceptor Improvements
- 15.7.1. Annotations with Behavior
- 15.7.2. Feedback Welcome
- 15.1. Intercepting Methods
- 16. Transactions
- 16.1. ACID Transactions
- 16.1.1. Is the TravelAgent EJB Atomic?
- 16.1.2. Is the TravelAgent EJB Consistent?
- 16.1.3. Is the TravelAgent EJB Isolated?
- 16.1.4. Is the TravelAgent EJB Durable?
- 16.2. Declarative Transaction Management
- 16.2.1. Transaction Scope
- 16.2.2. Transaction Attributes
- 16.2.2.1. Using the @TransactionAttribute annotation
- 16.2.2.2. Setting a transaction attribute within XML
- 16.2.2.3. Transaction attributes defined
- 16.2.2.4. EJB 3.0 persistence and transaction attributes
- 16.2.2.5. Message-driven beans and transaction attributes
- 16.2.2.6. EJB endpoints and transaction attributes
- 16.2.3. Transaction Propagation
- 16.2.3.1. Transactions and persistence context propagation
- 16.3. Isolation and Database Locking
- 16.3.1. Dirty, Repeatable, and Phantom Reads
- 16.3.1.1. Dirty reads
- 16.3.1.2. Repeatable reads
- 16.3.1.3. Phantom reads
- 16.3.2. Database Locks
- 16.3.3. Transaction Isolation Levels
- 16.3.4. Balancing Performance Against Consistency
- 16.3.4.1. Controlling isolation levels
- 16.3.5. Optimistic Locking
- 16.3.6. Programmatic Locking
- 16.3.1. Dirty, Repeatable, and Phantom Reads
- 16.4. Nontransactional EJBs
- 16.5. Explicit Transaction Management
- 16.5.1. Transaction Propagation in Bean-Managed Transactions
- 16.5.1.1. Message-driven beans and bean-managed transactions
- 16.5.2. Heuristic Decisions
- 16.5.3. UserTransaction
- 16.5.4. Status
- 16.5.5. EJBContext Rollback Methods
- 16.5.1. Transaction Propagation in Bean-Managed Transactions
- 16.6. Exceptions and Transactions
- 16.6.1. Application Exceptions Versus System Exceptions
- 16.6.1.1. System exceptions
- 16.6.1.2. Application exceptions
- 16.6.1. Application Exceptions Versus System Exceptions
- 16.7. Transactional Stateful Session Beans
- 16.7.1. The Transactional Method-Ready State
- 16.7.1.1. Transitioning into the Transactional Method-Ready state
- 16.7.1.2. Life in the Transactional Method-Ready state
- 16.7.1. The Transactional Method-Ready State
- 16.8. Conversational Persistence Contexts
- 16.1. ACID Transactions
- 17. Security
- 17.1. Authentication and Identity
- 17.2. Authorization
- 17.2.1. Assigning Method Permissions
- 17.2.2. Identifying Specific Methods in XML
- 17.2.2.1. Wildcard declarations
- 17.2.2.2. Named method declarations
- 17.2.2.3. Specific method declarations
- 17.2.2.4. Remote/home/local differentiation
- 17.2.3. Excluded Methods
- 17.3. The RunAs Security Identity
- 17.4. Programmatic Security
- 18. EJB 3.0: Web Services Standards
- 18.1. Web Services Overview
- 18.2. XML Schema and XML Namespaces
- 18.2.1. XML Schema
- 18.2.2. XML Namespaces
- 18.3. SOAP 1.1
- 18.3.1. Web Services Styles
- 18.3.2. Exchanging SOAP Messages with HTTP
- 18.3.3. Now You See It, Now You Don't
- 18.4. WSDL 1.1
- 18.4.1. The <definitions> Element
- 18.4.2. The <portType> and <message> Elements
- 18.4.3. The <types> Element
- 18.4.4. The <binding> and <service> Elements
- 18.5. UDDI 2.0
- 18.6. From Standards to Implementation
- 19. EJB 3.0 and Web Services
- 19.1. Accessing Web Services with JAX-RPC
- 19.1.1. Generating JAX-RPC Artifacts from WSDL
- 19.1.2. Calling a Service from an EJB
- 19.1.3. The <service-ref> Deployment Element
- 19.1.4. The JAX-RPC Mapping File
- 19.2. Defining a Web Service with JAX-RPC
- 19.2.1. The WSDL Document
- 19.2.2. The Service Endpoint Interface
- 19.2.3. The Stateless Bean Class
- 19.2.4. The Deployment Files
- 19.2.4.1. The WSDL file
- 19.2.4.2. The JAX-RPC mapping file
- 19.2.4.3. The webservices.xml file
- 19.3. Using JAX-WS
- 19.3.1. The @WebService Annotation
- 19.3.2. The @WebMethod Annotation
- 19.3.3. The @SOAPBinding Annotation
- 19.3.4. The @WebParam Annotation
- 19.3.5. The @WebResult Annotation
- 19.3.6. The @OneWay Annotation
- 19.3.7. Separating the Web Services Contract
- 19.3.8. The Service Class
- 19.3.9. The Service Endpoint Interface
- 19.3.10. The @WebServiceRef Annotation
- 19.4. Other Annotations and APIs
- 19.1. Accessing Web Services with JAX-RPC
- 20. Java EE
- 20.1. Servlets
- 20.2. JavaServer Pages
- 20.3. Web Components and EJB
- 20.4. Filling in the Gaps
- 20.4.1. Persistence Unit Scope
- 20.4.2. Java EE Application Client Components
- 20.4.3. Guaranteed Services
- 20.5. Fitting the Pieces Together
- 21. EJB Design in the Real World
- 21.1. Predesign: Containers and Databases
- 21.1.1. Container Capabilities
- 21.1.2. Database Capabilities
- 21.2. Design
- 21.2.1. Business Entity Identification
- 21.2.2. Technical Architecture
- 21.2.3. EJB and Entity Bean Identification
- 21.2.3.1. Identifying entity beans
- 21.2.3.2. Identifying session beans
- 21.2.3.3. Identifying message-driven beans
- 21.2.4. EJB Details
- 21.2.4.1. Stateless versus stateful session beans
- 21.2.4.2. Local versus remote interfaces
- 21.2.5. Entity Details
- 21.2.5.1. Returning entity data from EJBs
- 21.2.5.2. Minimizing database access
- 21.2.5.3. Caching
- 21.2.5.4. Combining queries
- 21.2.5.5. Minimizing updates
- 21.2.6. Fleshing Out the Design
- 21.2.6.1. Don't confuse EJB types
- 21.2.6.2. Minimize transaction scope
- 21.2.7. Exceptions
- 21.2.7.1. Identifying business exceptions
- 21.2.7.2. Designing the exception hierarchy
- 21.2.7.3. Deciding on rollback exceptions
- 21.2.7.4. Checked versus unchecked exceptions
- 21.2.7.5. Wrap subsystem exceptions
- 21.2.8. Utility Classes
- 21.3. Should You Use EJBs?
- 21.3.1. When to Use EJBs
- 21.3.2. When Not to Use EJBs
- 21.3.3. Alternatives to EJBs
- 21.3.4. Alternatives to Java Persistence
- 21.3.4.1. JDBC
- 21.3.4.2. Others
- 21.4. Wrapping Up
- 21.1. Predesign: Containers and Databases
- 1. Introduction
- II. The JBoss Workbook
- 22. Introduction
- 22.1. Contents of the JBoss Workbook
- 22.1.1. Online Resources
- 22.1. Contents of the JBoss Workbook
- WORKBOOK 1. JBoss Installation and Configuration
- 23.1. About JBoss
- 23.2. Installing the JBoss Application Server
- 23.2.1. Discovering the JBoss Directory Structure
- 23.2.2. JBoss Configuration Files
- 23.2.3. Deployment in JBoss
- 23.3. A Quick Look at JBoss Internals
- 23.3.1. Microkernel Architecture
- 23.3.2. Hot Deployment
- 23.3.3. Net Boot
- 23.3.4. Detached Invokers
- 23.4. Exercise Code Setup and Configuration
- 23.4.1. Exercise Directory Structure
- 23.4.2. Environment Setup
- WORKBOOK 2. Exercises for Chapter 4
- 24.1. Exercise 4.1: Your First Beans with JBoss
- 24.1.1. Start Up JBoss
- 24.1.2. Initialize the Database
- 24.1.3. Build and Deploy the Example Programs
- 24.1.4. Deconstructing build.xml
- 24.1.5. JBoss Specifics
- 24.1.5.1. Remote JNDI binding
- 24.1.5.2. persistence.xml
- 24.1.6. Examine and Run the Client Applications
- 24.1.6.1. Client.java
- 24.1.7. Viewing the Database
- 24.2. Exercise 4.2: JNDI Binding with Annotations
- 24.2.1. Start Up JBoss
- 24.2.2. Initialize the Database
- 24.2.3. Build and Deploy the Example Programs
- 24.2.4. Using @RemoteBinding
- 24.2.4.1. TravelAgentBean.java
- 24.2.4.2. Client.java
- 24.2.5. Run the client
- 24.3. Exercise 4.3: JNDI Binding with XML
- 24.3.1. Start Up JBoss
- 24.3.2. Initialize the Database
- 24.3.3. Build and Deploy the Example Programs
- 24.3.4. The jboss.xml Deployment Descriptor
- 24.3.4.1. jboss.xml
- 24.3.4.2. Client.java
- 24.3.5. Run the Client
- 24.1. Exercise 4.1: Your First Beans with JBoss
- WORKBOOK 3. Exercises for Chapter 5
- 25.1. Exercise 5.1: Interacting with EntityManager
- 25.1.1. Start Up JBoss
- 25.1.2. Initialize the Database
- 25.1.3. Build and Deploy the Example Programs
- 25.1.4. Using find( ) and merge( )
- 25.1.4.1. TravelAgentBean.java
- 25.1.4.2. Run the client
- 25.1.5. Transaction Versus Extended Persistence Contexts
- 25.1.5.1. TransactionPersistenceContextBean.java
- 25.1.5.2. Client_2.java
- 25.1.5.3. Run the client
- 25.1.6. FlushModeType Behavior
- 25.1.6.1. TravelAgentBean.java
- 25.1.6.2. Run the client
- 25.2. Exercise 5.2: Standalone Persistence
- 25.2.1. build.xml
- 25.2.2. Initialize the Database
- 25.2.3. Build the Example Program
- 25.2.4. Examine the JAR
- 25.2.4.1. persistence.xml
- 25.2.5. Examine the Standalone Application
- 25.1. Exercise 5.1: Interacting with EntityManager
- WORKBOOK 4. Exercises for Chapter 6
- 26.1. Exercise 6.1: Basic Property Mappings
- 26.1.1. Start Up JBoss
- 26.1.2. Initialize the Database
- 26.1.3. Build and Deploy the Example Programs
- 26.1.4. Examine the Customer Entity
- 26.1.4.1. Customer.java
- 26.1.5. Examine TravelAgentBean
- 26.1.5.1. TravelAgentBean.java
- 26.1.6. Examine the Client
- 26.1.7. Run the Client
- 26.2. Exercise 6.2: @IdClass
- 26.2.1. Start Up JBoss
- 26.2.2. Initialize the Database
- 26.2.3. Build and Deploy the Example Programs
- 26.2.4. Examine the Example Files
- 26.2.5. Run the Client
- 26.3. Exercise 6.3: @EmbeddedId
- 26.3.1. Start Up JBoss
- 26.3.2. Initialize the Database
- 26.3.3. Build and Deploy the Example Programs
- 26.3.4. Examine the Customer Entity
- 26.3.4.1. Customer.java
- 26.3.5. Examine Other Files
- 26.3.6. Run the Client
- 26.4. Exercise 6.4: Multitable Mappings
- 26.4.1. Start Up JBoss
- 26.4.2. Initialize the Database
- 26.4.3. Build and Deploy the Example Programs
- 26.4.4. Examine the Customer Entity
- 26.4.4.1. Customer.java
- 26.4.5. Examine Other Files
- 26.4.6. Run the Client
- 26.5. Exercise 6.5: Embeddable Classes
- 26.5.1. Start Up JBoss
- 26.5.2. Initialize the Database
- 26.5.3. Build and Deploy the Example Programs
- 26.5.4. Examine the Customer Entity
- 26.5.5. Examine Other Files
- 26.5.6. Run the Client
- 26.1. Exercise 6.1: Basic Property Mappings
- WORKBOOK 5. Exercises for Chapter 7
- 27.1. Exercise 7.1: Cascading
- 27.1.1. Start Up JBoss
- 27.1.2. Initialize the Database
- 27.1.3. Build the Example Programs
- 27.1.4. Examine the Entities
- 27.1.5. Examine Client1
- 27.1.5.1. Client1.java
- 27.1.5.2. createCustomerAddress( )
- 27.1.5.3. cascadeMergeAddress( )
- 27.1.5.4. cascadeRemoveAddress( )
- 27.1.6. Run Client1
- 27.1.7. Examine Client2
- 27.1.7.1. Client2.java
- 27.1.8. Run Client2
- 27.2. Exercise 7.2: Inverse Relationships
- 27.2.1. Start Up JBoss
- 27.2.2. Initialize the Database
- 27.2.3. Build the Example Programs
- 27.2.4. Examine the Entities
- 27.2.5. Examine Client1
- 27.2.5.1. Client1.java
- 27.2.6. Run Client1
- 27.3. Exercise 7.3: Lazy Initialization
- 27.3.1. Start Up JBoss
- 27.3.2. Build and Deploy the Example Programs
- 27.3.3. Initialize the Database
- 27.3.4. Examine the DataAccess EJB
- 27.3.4.1. DataAccessBean.java
- 27.3.5. Examine the Client
- 27.3.5.1. Client.java
- 27.3.6. Run the Client
- 27.1. Exercise 7.1: Cascading
- WORKBOOK 6. Exercises for Chapter 8
- 28.1. Exercise 8.1: Single Table per Hierarchy
- 28.1.1. Start Up JBoss
- 28.1.2. Initialize the Database
- 28.1.3. Build and Deploy the Example Programs
- 28.1.4. Examine the Database Schema
- 28.1.5. Examine the Code
- 28.1.5.1. DataAccessBean.java
- 28.1.5.2. Client.java
- 28.1.6. Run the Client
- 28.2. Exercise 8.2: Single Table per Hierarchy
- 28.2.1. Start Up JBoss
- 28.2.2. Initialize the Database
- 28.2.3. Build and Deploy the Example Programs
- 28.2.4. Examine the Database Schema
- 28.2.5. Examine the Code
- 28.2.6. Run the Client
- 28.3. Exercise 8.3: JOINED Inheritance Strategy
- 28.3.1. Start Up JBoss
- 28.3.2. Initialize the Database
- 28.3.3. Build and Deploy the Example Programs
- 28.3.4. Examine the Database Schema
- 28.3.5. Examine the Code
- 28.3.6. Run the Client
- 28.1. Exercise 8.1: Single Table per Hierarchy
- WORKBOOK 7. Exercises for Chapter 9
- 29.1. Exercise 9.1: Query and EJB QL Basics
- 29.1.1. Initialize the Database
- 29.1.2. Build the Example Programs
- 29.1.3. Example Basics
- 29.1.4. Parameters and Paging
- 29.1.4.1. Run the example
- 29.1.5. The SELECT Clause
- 29.1.5.1. columnResultSet( )
- 29.1.5.2. nestedRelationshipPropertyResultSet( )
- 29.1.5.3. constructorExpression( )
- 29.1.5.4. Run the example
- 29.1.6. The IN Operator and INNER JOIN
- 29.1.6.1. Run the example
- 29.1.7. LEFT JOIN
- 29.1.7.1. Run the example
- 29.1.8. Fetch Joins
- 29.1.8.1. noJoin( )
- 29.1.8.2. joinFetch( )
- 29.1.8.3. Run the example
- 29.1.9. Using DISTINCT
- 29.1.9.1. Run the example
- 29.1.10. The WHERE Clause and Literals
- 29.1.10.1. Run the example
- 29.1.11. The WHERE Clause and BETWEEN
- 29.1.11.1. Run the example
- 29.1.12. The WHERE Clause and IN
- 29.1.12.1. Run the example
- 29.1.13. The WHERE Clause and IS NULL
- 29.1.13.1. Run the example
- 29.1.14. The WHERE Clause and IS EMPTY
- 29.1.14.1. Run the example
- 29.1.15. The WHERE Clause and MEMBER OF
- 29.1.15.1. Run the example
- 29.1.16. The WHERE Clause and LIKE
- 29.1.16.1. Run the example
- 29.1.16.2. Run the example
- 29.1.17. Aggregate Functions
- 29.1.17.1. Run the example
- 29.1.18. The ORDER BY Clause
- 29.1.18.1. Run the example
- 29.1.19. GROUP BY and HAVING
- 29.1.19.1. Run the example
- 29.1.20. Subqueries
- 29.1.20.1. Run the example
- 29.1.21. Exercise 9.2: Native SQL Queries
- 29.1.22. Initialize the Database
- 29.1.23. Build the Example Program
- 29.1.24. Examine the Example
- 29.1.24.1. nativeSql( )
- 29.1.24.2. nativeWithMultipleEntities( )
- 29.1.24.3. mixedNative( )
- 29.1.25. Run the Example
- 29.1. Exercise 9.1: Query and EJB QL Basics
- WORKBOOK 8. Exercises for Chapter 10
- 30.1. Exercise 10.1: Entity Callbacks
- 30.1.1. Start Up JBoss
- 30.1.2. Initialize the Database
- 30.1.3. Build and Deploy the Example Programs
- 30.1.4. Examine the Customer Entity
- 30.1.4.1. Customer.java
- 30.1.5. Examine TravelAgentBean
- 30.1.5.1. TravelAgentBean.java
- 30.1.6. Examine the Client
- 30.1.7. Run the Client
- 30.2. Exercise 10.2: Entity Listeners
- 30.2.1. Start Up JBoss
- 30.2.2. Initialize the Database
- 30.2.3. Build and Deploy the Example Programs
- 30.2.4. Examine the Entity Listener
- 30.2.5. Examine the JMX MBean
- 30.2.5.1. EntityStats.java
- 30.2.5.2. EntityStatsMBean.java
- 30.2.5.3. jboss-service.xml
- 30.2.6. Examine the Customer Entity
- 30.2.7. Run the Client
- 30.2.8. Examine the JMX Management Console
- 30.1. Exercise 10.1: Entity Callbacks
- WORKBOOK 9. Exercises for Chapter 11
- 31.1. Exercise 11.1: Stateless Session Bean
- 31.1.1. Start Up JBoss
- 31.1.2. Initialize the Database
- 31.1.3. Build and Deploy the Example Programs
- 31.1.4. Examine ProcessPaymentBean
- 31.1.5. Examine DataAccessBean
- 31.1.6. Examine the Client
- 31.1.7. Run the Client Application
- 31.2. Exercise 11.2: XML Override
- 31.2.1. Start Up JBoss
- 31.2.2. Initialize the Database
- 31.2.3. Build and Deploy the Example Programs
- 31.2.4. Examine ProcessPaymentBean
- 31.2.4.1. ejb-jar.xml
- 31.2.5. Examine the Client
- 31.2.6. Run the Client Application
- 31.3. Exercise 11.3: Annotationless Stateless Session Bean
- 31.3.1. Start Up JBoss
- 31.3.2. Initialize the Database
- 31.3.3. Build and Deploy the Example Programs
- 31.3.4. Run the Client
- 31.4. Exercise 11.4: Stateful Session Bean
- 31.4.1. Start Up JBoss
- 31.4.2. Initialize the Database
- 31.4.3. Build and Deploy the Example Programs
- 31.4.4. Examine ProcessPaymentBean and TravelAgentBean
- 31.4.5. Examine DataAccessBean
- 31.4.6. Examine the Client
- 31.4.7. Run the Application
- 31.5. Exercise 11.5: Annotationless Stateful Session Bean
- 31.5.1. Start Up JBoss
- 31.5.2. Initialize the Database
- 31.5.3. Build and Deploy the Example Programs
- 31.5.4. Run the Application
- 31.1. Exercise 11.1: Stateless Session Bean
- WORKBOOK 10. Exercises for Chapter 12
- 32.1. Exercise 12.1: The Message-Driven Bean
- 32.1.1. Start Up JBoss
- 32.1.2. Initialize the Database
- 32.1.3. Create a New JMS Queue
- 32.1.3.1. Adding a JMS queue through a configuration file
- 32.1.3.2. jbossmq-titanqueues-service.xml
- 32.1.4. Build and Deploy the Example Programs
- 32.1.5. Examine ProcessPaymentBean and DataAccessBean
- 32.1.6. Examine the Client Applications
- 32.1.6.1. JmsClient_ReservationProducer.java
- 32.1.6.2. JmsClient_TicketConsumer.java
- 32.1.7. Examine ReservationProcessorBean
- 32.1.8. Run the Client Applications
- 32.1. Exercise 12.1: The Message-Driven Bean
- WORKBOOK 11. Exercises for Chapter 13
- 33.1. Exercise 13.1: EJB Timer Service
- 33.1.1. Start Up JBoss
- 33.1.1.1. Initialize the Database
- 33.1.1.2. Build and Deploy the Example Programs
- 33.1.1.3. Examine ShipMaintenanceBean
- 33.1.1.4. Examine the Client
- 33.1.1.5. Run the Application
- 33.1.1. Start Up JBoss
- 33.1. Exercise 13.1: EJB Timer Service
- WORKBOOK 12. Exercises for Chapter 15
- 34.1. Exercise 15.1: EJB Interceptors
- 34.1.1. Start Up JBoss
- 34.1.1.1. Initialize the Database
- 34.1.1.2. Build and Deploy the Example Programs
- 34.1.1.3. Examine the Code
- 34.1.1.4. Run the Application
- 34.1.1. Start Up JBoss
- 34.2. Exercise 15.2: Intercepting EJB Callbacks
- 34.2.1. Start Up JBoss
- 34.2.1.1. Initialize the Database
- 34.2.1.2. Build and Deploy the Example Programs
- 34.2.1.3. Examine the Code
- 34.2.1.4. Run the Client
- 34.2.1. Start Up JBoss
- 34.1. Exercise 15.1: EJB Interceptors
- WORKBOOK 13. Exercises for Chapter 16
- 35.1. Exercise 16.1: Conversational Persistence Contexts
- 35.1.1. Start Up JBoss
- 35.1.2. Initialize the Database
- 35.1.3. Build and Deploy the Example Programs
- 35.1.4. Examine the Server Code
- 35.1.5. Examine the Client
- 35.1.6. Run the Application
- 35.1. Exercise 16.1: Conversational Persistence Contexts
- WORKBOOK 14. Exercises for Chapter 17
- 36.1. Exercise 17.1: Security
- 36.1.1. Configure JBoss Security
- 36.1.1.1. users-titan.properties
- 36.1.1.2. roles-titan.properties
- 36.1.2. Start Up JBoss
- 36.1.3. Initialize the Database
- 36.1.4. Build and Deploy the Example Programs
- 36.1.5. Examine the ProcessPaymentBean Class
- 36.1.6. Examine the Client
- 36.1.7. Run the Application
- 36.1.1. Configure JBoss Security
- 36.2. Exercise 17.2: Securing Through XML
- 36.2.1. Configure JBoss Security
- 36.2.2. Start Up JBoss
- 36.2.3. Initialize the Database
- 36.2.4. Build and Deploy the Example Programs
- 36.2.5. Examine the JBoss Configuration Files
- 36.2.6. Run the Application
- 36.1. Exercise 17.1: Security
- WORKBOOK 15. Exercises for Chapter 19
- 37.1. Exercise 19.1: Exposing a Stateless Bean
- 37.1.1. Start Up JBoss
- 37.1.2. Initialize the Database
- 37.1.3. Build and Deploy the Example Programs
- 37.1.4. Examining TravelAgentBean
- 37.1.5. Examining the Generated WSDL
- 37.1.6. Examining the Client
- 37.1.7. The Java EE Application Client Deployment Descriptor
- 37.1.8. The JBoss Application Client Deployment Descriptor
- 37.1.9. Examining the Service Endpoint Interface
- 37.1.10. Examining the JAX-RPC Mapping File
- 37.1.11. Running the Client
- 37.1.12. Viewing the Database
- 37.2. Exercise 19.2: Using a .NET Client
- 37.2.1. Installing the Necessary Software
- 37.2.1.1. Windows
- 37.2.1.2. Unix
- 37.2.2. Start Up JBoss
- 37.2.3. Initialize the Database
- 37.2.4. Build and Deploy the Titan JAR
- 37.2.5. Examine the Client
- 37.2.6. Compile the Client
- 37.2.6.1. Windows
- 37.2.6.2. Unix
- 37.2.7. Run the Client
- 37.2.1. Installing the Necessary Software
- 37.1. Exercise 19.1: Exposing a Stateless Bean
- 22. Introduction
- III. Appendix
- A. JBoss Database Configuration
- A.1. Set Up the Database
- A.1.1. Basic Setup
- A.1.2. titandb-ds.xml
- A.2. Examine the persistence.xml File
- A.2.1. persistence.xml
- A.3. Start Up JBoss
- A.4. Build and Deploy the Example Programs
- A.5. Examine and Run the Client Applications
- A.1. Set Up the Database
- A. JBoss Database Configuration
- About the Authors
- Colophon
- SPECIAL OFFER: Upgrade this ebook with OReilly