Enterprise Java Development@TOPIC@

Enterprise Computing with Java (605.784.31) Course Exercises

Revision: v2019-08-08

2019-08-22 07:13 EST

Abstract

This book contains lab exercises covering for JHU 605.784.31


General Instructions
1. Lab Exercises
I. Enterprise Java (605.784.31) Development Environment Setup
Purpose
2. Java JDK Setup
2.1. Download and Install JDK 11
2.2. Add JDK to PATH
2.3. Verify your JDK is installed
3. Git Client Setup
3.1. Install Git Client
3.2. Get Class Repository
4. Maven Environment Setup
4.1. Maven Installation
4.2. Maven Configuration
4.3. Test Maven Build
4.4. Missing Dependencies
4.5. Build Local Site
5. JBoss (Wildfly) Setup
5.1. Download and Install Wildfly 17.0.1.Final
5.2. Configure JBoss Server
5.3. Add JBoss Admin Account
5.4. Enable JBoss Remote Debugging
5.5. (Optional) Using Alternate Networks
6. H2 Database Setup
6.1. Locate the h2*.jar file
6.2. Start Server
6.3. Access DB User Interface
6.4. Activate H2 Server Profile for Builds
6.5. Update JBoss to use Server Mode
7. Eclipse Setup
7.1. Download and Install Eclipse
7.2.
7.3. Define JDK location
7.4. Setup Maven Eclipse Integration (m2e)
7.5. Setup Git Eclipse Team Provider
7.6. Setup JBoss Eclipse Integration
8. Ant Setup
8.1. Install Ant
II. JavaSE: First Simple Module Exercise
Purpose
1. Goals
2. Objectives
9. Develop and Test Module using Command Line Tools (OPTIONAL!)
9.1. Summary
10. Automate Build and Testing with Ant (OPTIONAL!)
10.1. Summary
11. Adding Logging
11.1. Summary
12. Creating Portable and Repeatable Project Builds with Maven
12.1. Summary
13. Leverage IDE using Eclipse
13.1. Import a project into Eclipse
13.2. Setup Eclipse to be able to execute Maven project goals
13.3. Setup environment to enable interactive debugging
13.4. Summary
III. Java Persistence API: Entity Manager Exercise
Purpose
1. Goals
2. Objectives
14. Setup and Start Database
14.1. Summary
15. Create Core Project POM
15.1. Summary
16. Setup Database Schema
16.1. Summary
17. Add SQL Tuning
17.1. Summary
18. JPA Persistence Unit Setup
18.1. Summary
19. Setup JPA TestCase
19.1. Summary
20. Ready Project for Import into Eclipse
20.1. Summary
21. Test EntityManager Methods
21.1. Summary
22. Automatically Generate Database Schema
22.1. Summary
23. Create JPA Parent POM
23.1. Summary
IV. Java Persistence API: Entity Mapping Exercise
Purpose
24. JPA Entity Exercise Setup
24.1. Setup Maven Project
25. JPA Entity Class Basics
25.1. Create POJO Class using descriptor
25.2. Create POJO Class using annotations
25.3. Summary
26. Mapping Class Properties
26.1. Map Entity to Specific Table
26.2. Using JPA Property Access
26.3. Summary
27. JPA Enum Mapping
27.1. Mapping Enum Ordinal Values
27.2. Mapping Enum Name Values
27.3. Mapping Enum Alternate Values
27.4. Summary
28. Mapping Temporal Types
28.1. Mapping Temporal Types
28.2. Summary
29. Mapping Large Objects
29.1. Mapping CLOBS
29.2. Mapping BLOBS
29.3. Summary
30. Primary Key Generation
30.1. IDENTITY Primary Key Generation Strategy
30.2. SEQUENCE Primary Key Generation Strategy
30.3. TABLE Primary Key Generation Strategy
30.4. Summary
31. Mapping Compound Primary Keys
31.1. Using Embedded Compound Primary Keys
31.2. Using Compound Primary Keys as IdClass
31.3. Summary
32. Mapping Embedded Objects within Classes
32.1. Mapping an Embedded Object
32.2. Mapping Muti-level Embedded Objects
32.3. Summary
33. Objects Mapped to Multiple Tables
33.1. Mapping to Secondary Tables
33.2. Summary
V. Java Persistence API: Relationship Exercise
Purpose
34. JPA Entity Exercise Setup
34.1. Setup Maven Project
35. Mapping One-to-One Relationships
35.1. Setup
35.2. One-to-One Uni-directional Relationships
35.2.1. One-to-One Uni-directional Using a Foreign Key
35.2.2. One-to-One Uni-directional Using a Join Table
35.2.3. One-to-One Uni-directional Using a Primary Key Join
35.2.4. One-to-One Uni-directional Using MapsId
35.2.5. One-to-One Uni-directional Using Composite Primary/Foreign Keys
35.3. Mapping One-to-One Bi-directional Relationships
35.3.1. One-to-One Bi-directional Joined By Primary Key
35.3.2. One-to-One Bi-directional 0..1 Owner Relationship
35.3.3. One-to-One Bi-directional 0..1 Inverse Relationship
35.4. One-to-One EntityManager Automated Actions
35.4.1. One-to-One Using Cascades From Owner
35.4.2. One-to-One Using Cascades From Inverse
35.4.3. One-to-One Using Orphan Removal
35.5. Summary
36. Mapping One-to-Many Uni-directional Relationships
36.1. Setup
36.2. One-to-Many Uni-directional
36.2.1. One-to-Many Uni-directional with Join Table
36.2.2. One-to-Many Uni-directional using Foreign Key Join (from Child Table)
36.2.3. One-to-Many Uni-directional Mapping of Simple Types using ElementCollection
36.2.4. One-to-Many Uni-directional Mapping of Embeddable Type using ElementCollection
36.3. One-to-Many Provider Actions
36.3.1. One-to-Many Orphan Removal
36.4. Summary
37. JPA Collections
37.1. Setup
37.2. Entity Identity
37.2.1. Instance Id
37.2.2. Primary Key Id
37.2.3. Switching Ids
37.2.4. Business Id
37.3. Collection Ordering
37.3.1. Ordered Collections
37.4. Collection Interfaces
37.4.1. Using Maps with Collections
37.5. Summary
38. Mapping Many-to-One, Uni-directional Relationships
38.1. Setup
38.2. Many-to-One Uni-directional
38.2.1. Many-to-One Uni-directional Using a Foreign Key
38.2.2. Many-to-One Uni-directional Using a Compound Foreign Key
38.2.3. Many-to-One Uni-directional Using a MapsId
38.3. Summary
39. Mapping One-to-Many/Many-to-One Bi-directional Relationships
39.1. Setup
39.2. One-to-Many Bi-directional using Foreign Key Join
39.3. One-to-Many Bi-directional using Join Table
39.4. One-to-Many Bi-directional using Derived Composite Primary
39.5. Summary
40. Mapping Many-to-Many Relationships
40.1. Setup
40.2. Many-to-Many Uni-directional
40.3. Many-to-Many Bi-directional
40.4. Summary
VI. Java Persistence API: Query Exercise
Purpose
41. Exercise Data Model
41.1. Class Model
41.2. Database Schema
41.3. Object Instances
42. JPA Entity Exercise Setup
42.1. Setup Maven Project
43. Creating JPA Queries
43.1. Setup
43.2. Create/Execute Query
43.2.1. Multiple Results
43.2.2. Single Result
43.2.3. Single Result - NoResultException
43.2.4. Single Result - NonUniqueResultException
43.3. Query Parameters
43.4. Paging Query Results
43.5. Named Query
43.6. Value Queries
43.6.1. Retrieve Value
43.6.2. Retrieve Function Result Value
43.6.3. Retrieve Multiple Values
43.6.4. Encapsulate Row Values with ResultClass
43.7. Summary
44. SQL Queries
44.1. Setup
44.2. Create/Execute SQL Query
44.3. SQL Query Entity Result Mapping
44.4. SQL Result Set Mapping
44.5. Summary
45. Bulk Updates
45.1. Setup
45.2. Additional Setup
45.3. Using JPQL Bulk Update
45.4. Using Native SQL Bulk Update
45.5. Summary
46. Query Locks
46.1. Setup
46.2. Additional Setup
46.3. Using No Locks
46.4. Adding Lock Mode
46.5. Using Pessimistic Write Lock
46.6. Summary
VII. Basic EJB Development Exercise
Purpose
1. Goals
2. Objectives
47. Multi-Module JavaEE Project
47.1. Purpose
47.1.1. Goals
47.1.2. Objectives
47.2. Create Root Module
47.3. Create EJB Module
47.4. Manage Application Server
47.4.1. Application Server Setup
47.4.2. Standalone Application Server
47.4.3. Embedded Application Server
47.5. Summary
48. EAR Deployment
48.1. Purpose
48.1.1. Goals
48.1.2. Objectives
48.2. Create EAR Module
48.3. Create RMI Test Module
48.4. Deploy the EAR
48.5. Lookup and Invoke @Remote Interface
48.6. Directory Sanity Check
48.7. Summary
49. WAR Deployment
49.1. Purpose
49.1.1. Goals
49.1.2. Objectives
49.2. Create WAR Module
49.3. Add RMI Test
49.4. Embed EJB in WAR Module
49.5. Summary
50. Build Commands
50.1. Purpose
50.1.1. Goals
50.1.2. Objectives
50.2. mvn (phase)
50.3. mvn (phase) -rf :module
50.4. mvn (phase) -f (path to module)
50.5. mvn clean -Pundeploy
50.6. mvn clean -Dit.test=fully.qualified.ITPath#testMethod
50.7. Summary
51. Controlling JNDI Names
51.1. Purpose
51.1.1. Goals
51.1.2. Objectives
51.2. Eliminate Version# from EAR-based JNDI Name
51.3. Eliminate Version# from WAR-based JNDI Name
51.4. Summary
52. Debug Remote EJB
52.1. Purpose
52.1.1. Goals
52.1.2. Objectives
52.2. Running IT Tests in IDE
52.3. Debugging Deployment to Standalone Server
52.4. Debugging Deployment to Embedded Server
52.5. Summary
53. EJB Parent POM
53.1. Purpose
53.1.1. Goals
53.1.2. Objectives
53.2. Create Root POM
53.3. Summary
VIII. Implementing JPA-based EJBs and Remote Interfaces Lab
Purpose
1. Goals
2. Objectives
54. Getting Started
54.1. Start the Application Server
54.2. Build Solution
54.3. Build Exercise
54.4. Import Exercise into IDE
54.4.1. Exercise Modules
54.4.2. Impl Module Source Tree
54.4.3. EJB Module Source Tree
54.4.4. EAR Module Source and Deployable Artifact Tree
54.4.5. WAR Module Source Tree
54.4.6. RMI IT Test Module Source Tree
54.5. Summary
55. Server-side Persistence Unit
55.1. EJB Persistence Unit
55.2. Imported EJB - WAR Deployment
55.3. Embedded EJB - WAR Deployment
55.4. Summary
56. Remote Interface Issues
56.1. Serializable DTOs
56.2. Provider (Hibernate) Proxy Classes
56.3. Lazy Loading Exception
56.4. Cleansed BO/DTO
56.5. Pre-Loaded Entities
56.6. Separate DTO Classes
56.7. Summary