Skip to content

EJB 3 in Action

Best in textbook rentals since 2012!

ISBN-10: 1933988347

ISBN-13: 9781933988344

Edition: 2007

Authors: Debu Panda, Reza Rahman, Derek Lane

List price: $44.99
Blue ribbon 30 day, 100% satisfaction guarantee!
what's this?
Rush Rewards U
Members Receive:
Carrot Coin icon
XP icon
You have reached 400 XP and carrot coins. That is the daily max!

Description:

"EJB 3 in Action" tackles EJB 3 and the Java Persistence API head-on, providing practical code samples, real-life scenarios, best practices, design patterns, and performance tuning tips. This book builds on the contributions and strengths of seminal technologies like Spring, Hibernate, and TopLink. EJB 3 is the most important innovation introduced in Java EE 5.0. EJB 3 simplifies enterprise development, abandoning the complex EJB 2.x model in favor of a lightweight POJO framework. The new API represents a fresh perspective on EJB without sacrificing the mission of enabling business application developers to create robust, scalable, standards-based solutions. "EJB 3 in Action" is a…    
Customers also bought

Book details

List price: $44.99
Copyright year: 2007
Publisher: Manning Publications Company
Publication date: 4/24/2007
Binding: Paperback
Pages: 712
Size: 7.50" wide x 9.00" long x 1.50" tall
Weight: 2.640
Language: English

Derek Lane has over 17 years of professional software experience as an architect, manager, designer, analyst, developer and teacher. He has a versatile technical background and a passion for exploring new technologies.

Preface
Acknowledgments
About this book
Overview of the EJB Landscape
What's what in EJB 3
EJB overview
EJB as a component
EJB as a framework
Layered architectures and EJB
Why choose EJB 3?
Understanding EJB types
Session beans
Message-driven beans
Entities and the Java Persistence API
Getting inside EJB
Accessing EJB sendees: the EJB container
Accessing JPA services: the persistence provider
Gaining functionality with EJB services
Renaissance of EJB
HelloUser Example
Simplified programming model
Annotations instead of deployment descriptors
Dependency injection vs. JNDI lookup
Simplified persistence API
Unit-testable POJO components
EJB 3 and Spring
Summary
A first taste of EJB
New features: simplifying EJB
Replacing deployment descriptors with annotations
Introducing dependency injection
Introducing the ActionBazaar application
Starting with the architecture
An EJB 3-based solution
Building business logic with session beans
Using stateless beans
The stateless bean client
Using stateful beans
A stateful bean client
Messaging with message-driven beans
Producing a billing message
Using the order billing message processor MDB
Persisting data with EJB 3 JPA
Working with the Java Persistence API
Using the EntityManager
Summary
Building Business Logic with EJB 3
Building business logic with session beans
Getting to know session beans
Why use session beans?
Session beans: the basics
Understanding the programming rules
Conversational state and session bean types
Bean lifecycle callbacks
Stateless session beans
The BidManagerBean example
Using the @Stateless annotation
Specifying bean business interfaces
Using bean lifecycle callbacks
Stateful session beans
Additional programming rules
The BidderAccountCreatorBean example
Business interfaces for stateful beans
Stateful bean lifecycle callbacks
Session bean clients
Using the @EJB annotation
Injection and stateful session beans
Performance considerations for stateful beans
Using stateful session beans effectrvely
Stateful session bean alternatives
Session bean best practices
Summary
Messaging and developing MDBs
Messaging concepts
Message-oriented middleware
Messaging in Action Bazaar
Messaging models
Introducing Java Messaging Service
Developing the JMS message producer
The JMS message interface
Working with message-driven beans
Why use MDBS?
Programming rules
Developing a message consumer with MDB
Using the @MessageDriven annotation
Implementing the MessageListener
Using ActivationConfigProperty
Using bean lifecycle callbacks
Sending JMS messages from MDBs
Managing MDB transactions
MDB best practices
Summary
Learning advanced EJB concepts
EJB internals
EJB behind the scenes
EJB context: accessing the runtime environment
Accessing resources using DI and JNDI
Resource injection using @Resource
The @Resource annotation in action
Looking up resources and EJBs
AOP in the EJB world: interceptors
What is AOP?
What are interceptors?
Specifying interceptors
Implementing business interceptors
Lifecycle callback methods in the interceptor class
Scheduling: the EJB 3 timer service
What are timers?
Using the timer service
When to use EJB timers
Summary
Transactions and security
Understanding transactions
A transactional solution in ActionBazaar
ACID properties
Transaction management internals
Two-phase commit
Transaction management in EJB
Container-managed transactions
Snag-It ordering using CMT
The @TransactionManagement annotation
The @TransactionAttribute annotation
Marking a CMT for rollback
Transaction and exception handling
Bean-managed transactions
Snag-It ordering using BMT
Getting a UserTransaction
Using UserTransaction
The pros and cons of BMT
Exploring EJB security
Authentication vs. authorization
Users, groups, and roles
A security problem in ActionBazaar
EJB 3 and Java EE security
Declarative security
Using EJB programmatic security
Summary
3 Diving into the Java Persistence API (JPA)
Implementing domain models
Domain modeling and the JPA
Introducing domain models
The ActionBazaar problem domain
Domain model actors
The EJB 3 Java Persistence API
Domain objects as Java classes
Implementing domain objects with JPA
The @Entity annotation
Persisting entity data
Specifying entity identity
The Embeddable annotation
Entity relationships
@OneToOne
@OneToMany and @ManyToOne
@ManyToMany
Summary
Object-relational mapping
The impedance mismatch
Mapping objects to databases
Introducing O/R mapping
Mapping entities
Specifying the table
Mapping the columns
Using @Enumerated
Mapping CLOBs and BLOBs
Mapping temporal types
Mapping an entity to multiple tables
Generating primary keys
Mapping embeddable classes
Mapping entity relationships
Mapping one-to-one relationships
One-to-many and many-to-one
Many-to-many
Mapping inheritance
Single-table strategy
Joined-tables strategy
Table-per-class strategy
Mapping polymorphic relationships
Summary
Manipulating entities with EntityManager
Introducing the EntityManager
The EntityManager interface
The lifecycle of an entity
Persistence contexts, scope, and the EntityManager
Using the EntityManager in ActionBazaar
Creating EntityManager instances
Container-managed EntityManagers
Application-managed EntityManager
Managing persistence operations
Persisting entities
Retrieving entities by primary key
Updating entities
Deleting entities
Controlling updates with flush
Refreshing entities
Entity lifecycle listeners
Using an entity listener
Default listener classes
Listener class execution order and exclusion
Entity operations best practices
Summary
Using the query API and JPQL to retrieve entities
Introducing the query API
The big picture
Anatomy of a query
Defining named queries
Executing the queries
Creating a query instance
Working with the Query interface
Specifying query hints
Introducing JPQL
Defining statement types
Using the From clause
Conditional expressions and operators
Working with JPQL functions
Using a Select clause
Using aggregations
Ordering the query result
Using subqueries
Joining entities
Bulk updates and deletes
Native SQL queries
Using dynamic queries with native SQL
Using a named native SQL query
Summary
Putting EJB 3 Into Action
Packaging EJB 3 applications
Packaging your applications
Dissecting the Ear file
Loading the Ear module
Exploring class loading
Class-loading basics
Exposing the classic parent delegation model
Class loading in Java EE applications
Dependencies between Java EE modules
Packaging session and message-driven beans
Packaging EJB-JAR
Deployment descriptors vs. annotations
Overriding annotations with deployment descriptors
Specifying default interceptor settings
Using vendor-specific annotations and descriptors
Packaging entities
Exposing the persistence module
Describing the persistence module with persistence.xml
Performing O/R mapping with orm.xml
Best practices and common deployment issues
Packaging and deployment best practices
Troubleshooting common deployment problems
Summary
Effectively integrating EJB 3 across your application tiers
Design patterns and web technologies
Presentation tier
Using the Entity Access Object pattern
Visiting the Session Facade pattern
Accessing session beans from the web tier
Accessing session beans using dependency injection
Referencing session beans from helper classes
Dealing with transactions
Working with stateful session beans
Using JPA from the web tier
Using a container-managed entity manager
Using an application-managed EntityManager with JTA transactions
Accessing an application-managed EntityManager outside the container
Summary
Taming wild EJBs: performance and scalability
Handling entity locking issues
Understanding locking types
Optimistic locking and entity versioning
EntityManager and lock modes
Improving entity performance
Remodeling and schema redesign
Tuning the JDBC layer
Reducing database operations
Improving query performance
Caching
Improving performance of EJB 3 components
Session bean performance
Improving MDB performance
Clustering EJB applications
Collocated architecture
Load-balancing stateless session beans
Clustering statefal session beans
Entities and clustered cache
Summary
Migration and Interoperability Issues
Migration to EJB 3
Backward compatibility and interoperability with EJB 2
Packaging EJB 2 and EJB 3 together
Invoking EJB 2 from EJB 3
Using EJB 3 from EJB 2
Migrating session beans
Converting interface and bean classes
Resource usage
Transactions and security settings
Client applications
Migrating message-driven beans
Migrating CMP 2 entity beans to the EJB 3 JPA
Redesign your domain model
Using DTOs as entities
Entity bean classes and interfaces
Client applications
Migrating JDBC DAOs to use the EJB 3 JPA
Identifying entities
Reworking a DAO implementation class to use the EntityManager API
Swapping SQL queries for JPQL
Helping O/R frameworks to use the EJB 3 JPA
Approaches to migration
Strategies
Manual vs. automated
Summary
Exposing EJBs as web services
What is a web service?
Identifying web service components
Web services styles
Approaches to developing web services
JAX-WS: Java EE 5 web services platform
Introducing the web services platform
Why choose EJB over a POJO for a web service?
Developing EJB web services with JAX-WS 2.0
Using the @WebService annotation
Specifying the web service style with @SOAPBinding
Using @WebMethod
Using the @WebParam annotation
Using the @WebResult annotation
Using @OneWay and @HandlerChain
Accessing a web service from an EJB
Accessing the PlaceBid web service
EJB as a web service client
Best practices for web service development
Summary
EJB 3 and Spring
Introducing the Spring framework
Benefits of the Spring framework
The inversion of control principle
The separation of concerns principle
Using JPA with Spring
Building JPA EAOs for Spring
Configuring Spring to use the JPA
Combining the power of EJB 3 and Spring
Developing Spring-enabled EJBs
Using session beans from Spring beans
Summary
RMI and JNDI
Reviewing relational databases
Annotations reference
Deployment descriptors reference
Installing and configuring the Java EE 5 SDK
Resources
Index