Java EE 5 Programming with JSF, EJB 3.0, and JPA Using Rational Application Developer 7.5

aquahellishSoftware and s/w Development

Dec 13, 2013 (3 years and 8 months ago)

90 views

Java EE 5 Programming with JSF, EJB 3.0, and JPA Using Rational Application Developer
7.5


Outline
:


1. Java Enterprise Edition (EE) Overview




Objectives



Introduction to Java Platform



Java Community Process (JCP)



Introduction to Java EE



Why Move to Ja
va EE



Java EE
-

New and Enhanced Features



Java EE Software Packaging



Java EE Technologies



Summary



2. Introduction to Rational Application Developer (RAD) v7.5




Objectives



The RAD 7.5 Product



Eclipse Platform



Rational Web Developer



Rational Ap
plication Developer



Key Features in RAD v7.5



Views, Perspective, and Editor Areas



Basic Operations with RAD Views and Perspectives



The Java Perspective



The Debug Perspective



Navigator View



Package Explorer



Outline View



Task and Problems View



Buil
d and Validation



Import and Export Project



Code Completion, Templates and Snippets



Searching



Setup Compiler Class Path



JRE Switching



Refactoring



Changing Class Name



Changing Method Name



Changing Variable Name



Moving a Class to a Different Package




Extracting Code to a Method



Pull Up and Push Down Methods



Migrating Workspace from RAD v6 or WSAD v5.1.2



Project Interchange Feature



Summary



3. Introduction to JavaServer Faces




What is JavaServer Faces (JSF)?



Why Use JSF?



Nature of a JSF App
lication



The Sun Reference Implementation (RI)



JSF and MVC



Faces Servlet



Managed Bean



The View



A Simple JSF Application



The Input Form: form.jsp



The Result: thanks.jsp



The Controller: AddressBean



Page Flow or Navigation Rule



How Does the Applica
tion Work?



Under the Covers: The Rendered Form HTML



Under the Covers: The Layout Tree



4. Managed Bean




What is a Managed Bean?



Why Do You Need Managed Beans?



Managed Bean As a Controller



Registering a Managed Bean



Lifecycle of a Managed Bean



I
nitializing a Managed Bean



What Scope to Use?



Value Binding



Property Data Conversion



Advanced Property Types



Component Binding



Other Binding Types



Basic Input Processing



Advanced Input Processing



JSF Expression Language



Language Basics



Use of Ex
pression in JSF



Basic Expression



Property Access Expression



Map Access Expression



Complex Access Expression



Predefined Objects



Operators



5. User Interface Components




JSF UI Components



JSF Component Tag Libraries



Using the Tag Libraries



HTML

Tag Library



Identifying Components



Component Identifier



Client Identifier



Form Input Field Names



Labels and Images



Create a Form



Buttons



Links



Adding Parameters to Links



Text Input



Simple Check Box



Check Box Group



Check Box Group Example



Rad
io Button



List Boxes



Dynamic List Box



Example



Another Example



JSF Core Library



JSF Core Library
-

Components



JSF Component Model



Base Class Hierarchy



Useful Base Classes



Useful HTML Classes



6. JSF Event Handling




Objectives



Request Process
ing Phases



Action Request Processing Phases



JSF Event & Listener Model



JSF Event Classes



Event Classes



Event Classes: Hierarchy



Action Event Handling



Action Event: Example



Action Listener



Value Change Event



Value Change Event Handler



Listener Cl
asses



Listener Interfaces



Listener Classes: Hierarchy



Action Listener Class



Value Change Listener Class



Phase Event Listener



Request Processing Lifecycle



Phase Identifiers



7. JSF Navigation




Objectives



JSF Navigation



Example Action Listener



faces
-
config.xml File



JSF Navigation



Navigation Rules: Example



Choosing Between Redirect & Direct Rendering



Navigation: Scenarios



8. Validation




Objectives



Introduction



Validation



Standard Validators



<f:validateLength>



<f:validateDoubleRang
e>



<f:validateLongRange>



Checking for Required Values



Showing Validation Error Messages



Customizing Standard Error Messages



Standard Validation Error Messages



Validation Process



Sequence Diagram



Bypassing Validation



Immediate Command Components



I
mmediate Input Component



Accessing User Input



Immediate Example



Advanced Field Validation



Advanced Error Handling



9. Advanced GUI Components




Objectives



HTML Panel



Applying Styles



Grouping Components



Data Table



Using a Data Table



Data Table

Model



Using a Data Table



Displaying a Header and Footer Row



Applying Styles



Adding Links to a Row



Using Component Binding



Handling Action



Using the Data Table Model



Handling Action



10. JSF Techniques




A Typical Application



The Create Form



Create Action Method



Listing Items



Editing an Item



Adding the Edit Link



The Edit Form



Update Item



Things to Keep in Mind



11. Introduction to Facelets




Constructing and Rendering a View (JSP way)



Facelets



Getting Facelets



Using Facelets



Page

Templates



Define a Page Template



Define a Template Client



Summary



12. Enterprise JavaBeans (EJBs) Overview




Objectives



Need for EJBs



Distributed Computing



Distributed Transaction



Distributed Security



What are EJBs?



Main Characteristics of E
JBs



EJB Remote Method Call



EJB Architecture Components



EJB Client



EJB JAR File



EJB Container



EJB Server



Enterprise JavaBeans



Session Beans



Entity Beans



Java Persistence API
-

Entities



Message
-
Driven Beans (MDBs)



EJB Specification



Summary



13. Stateless Session Beans




Objectives



Session Beans



Stateless Session Bean



Stateless Session Bean Pooling



Stateless Session Bean Examples



Stateful Session Bean



Stateful Session Bean Examples



Annotations



Stateless Session Bean Components



Example
: Business Interface



Example: Bean Class



Alternative Example



JNDI
-

Overview



Example: The Client



Business Interface Details



Bean Class Details



Session Bean Lifecycle



Stateless Session Bean Lifecycle



Summary



Creating A Session Bean



Creating An EJ
B Project



The Client JAR



EJB Projects



Creating an EJB



Creating the EJB



Coding the Bean



Updating Interfaces



Dependencies



14. Stateful Session Beans




Objectives



Stateful Session Bean



Stateful Session Beans



Session Bean Lifecycle



Stateful Ses
sion Bean Lifecycle



Stateful Session Bean Components



Stateful Session Bean Example



Stateful Session Bean Client



Removing the Bean



Summary



15. Entities and Java Persistence API




Objectives



Data Persistence



Java Persistence API



Entities



Sessio
n Beans Vs Entities



Entities



Persisting and Retrieving Data



Accessing Entities



EntityManager & Persistence Unit



Persistence Context



Entities
-

Example



persistence.xml Hibernate Provider



persistence.xml Open JPA Provider



persistence.xml
-

Toplink



Entity Instance Lifecycle



Creating EntityManager in Session EJB



Creating EntityManager in a Plain Java Class



Working With the EntityManager Interface



Transaction Basics



Entity Lifecycle



When is an Entity Managed or Detached?



Implementing the CRUD Pa
ttern



Accessing Entities Using Stateless Session Beans



Inserting Data



Retrieving Data



Updating Data



Deleting Data



Merging Entities



Life
-
Cycle Callbacks



Example: Internal callback



External Callback Class



Listener Class
-

Example



Synchronizing wit
h Databases



Entity Lookup



JPAQL (JPA Query Language)



Summary



Creating Entities



JPA Project



Creating An Entity



Generated Entity Class



Code the Entity



JPA Tooling



Dependencies



16. References and Dependency Injection




Objectives



Role of Refer
ences



EJB Reference Annotations



Resource Reference Annotations



Dependency Injection



Annotation Injection



Example: Field Level Injection



Example: Method Level Injection



Deployment Descriptor Injection



Example: Deployment Descriptor Injection



Class
Level References



Multiple References



EJB References in Deployment Descriptors



Resource References in Deployment Descriptors



Reference Lookup



EJBContext



JNDI Lookup with EJBContext



Overriding Reference Annotations



Default Reference Name



Resolving R
eferences



mappedName Attribute



Overloaded Reference Names



Reference Best Practices



Summary



17. Java Persistence Query Language (JPA QL)




Objectives



JPA Query Language



Basic JPAQL Syntax



Simple SELECT Examples



Example of Using JPAQL



The SELEC
T clause



Reading Data from Code



The WHERE Clause



Example Using JPAQL from Session EJB



Named Query



Multiple Named Queries



Bulk Updates



Bulk Delete



Running Native SQL Query



Native SELECT Query



Native SQL Delete and Insert



Named Native Query



Summa
ry



18. Entity Relationship




Objectives



Relationship Between Entities



Anatomy of a Relationship



Foreign Key



Example Schema



One
-
to
-
One Unidirectional



Creating Entity Instances



Traversing the Relationship



The Cascade Behavior



One
-
to
-
One Bidirec
tional



Traversing the Relationship



One
-
To
-
Many and Many
-
To
-
One



Many
-
to
-
One Unidirectional



Creating Entity Instances



Traversing the Relationship



Modeling One
-
to
-
Many



Creating Entity Instances



Traversing the Relationship



Many
-
to
-
Many



Modeling Many
-
to
-
Many



Creating Entity Instances



Traversing Relationship



Unidirectional One
-
to
-
Many



Modeling Unidirectional One
-
to
-
Many



Creating Entity Instances



Traversing the Relationship



Relationship in JPA QL



Fetching Optimizations



Lazy vs. Eager Initializat
ion



Lazy Initialization



Problems with Lazy Initialization



Fetch Join Query



Summary



19. Entity Inheritance




Objectives



Inheritance



Inheritance Example



Inheritance and Entities



Inheritance Strategies



Inheritance Strategy 1: Single Table Per Cl
ass Hierarchy



Single Table Per Class Hierarchy



Table Structure: Single Table Per Class Hierarchy



Pros and Cons



Strategy 2: Table Per Concrete Class



Table Per Concrete Class



Table Per Concrete Class: JBoss Warning



Table Per Concrete Class



Table Stru
cture: Table Per Concrete Class



Table Per Concrete Class: Pros and Cons



Strategy 3: Joined Subclasses



Joined Subclasses



Table Structure: Joined Subclasses



Joined Subclasses: Pros and Cons



Which Approach To Use?



Summary



20. Message
-
Driven Beans




Objectives



The Trouble with RMI/IIOP



Messaging to the Rescue



Messaging Features



Message
-
Oriented Middleware



Messaging Domains



Publish/Subscribe



Point
-
to
-
Point



Java Message Service



JMS Programming: Overview



The JMS Interfaces



Integrating JMS an
d EJB



Message
-
Driven Beans Are Different From Other EJBs



Message
-
Driven Beans Cannot Talk to Their Clients



Message
-
Driven Beans are Stateless



Durable Subscription



Message
-
Driven Bean Interfaces



javax.jms.MessageListener



javax.jms.Message



Specialize
d Message Types



Lifecycle



Message Driven Bean
-

Example



Message Driven Bean
-

Client Example (JSP)



Transactions



Security



Load Balancing



Clustering and Topics



Clustering and Queues



A Few Tips



Poison Messages



How the Programmer Can Avoid Poison Me
ssages



How the System Administrator Can Avoid Poison Messages



Building a Response



Potential Problems



A Simple Alternative



Type Checking and Messages



Testing Message
-
Driven Beans



Summary



References



Configuring JMS



Creating an MDB In RAD



Coding th
e MDB



Specifying The Destination



Editing WebSphere Bindings



Set the Activation Spec



21. JAX
-
WS Introduction




Objectives



JAX Attack



JAX
-
WS Origins



JAX
-
WS Architecture and Tools



Providing a Service



Service Source (Option 1)



Service
-
enabling Ja
va



Service Source (Option 2)



Calling a Service



Client Source (Option 1)



Client Source (Option 2)



Advanced Features



Summary



Appendix A. JSF, EJB 3 and JPA Integration




Integrating JSF



EJB 3



JPA



Putting It All Together



Simple Application



Cod
e the JPA Entity



The Managed Bean



Managed Bean Option 1



Managed Bean Option 2



Accessing the Entity Manager



Local Entity Manager



Remote Session Bean EM



Entity As DTO



Managed Bean Scope



Summary