Enterprise Java Development@TOPIC@

Enterprise Computing with Java (605.784.31) Course Exercises

Revision: v2014-11-30

2015-11-18 03:51 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
2.2. 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. (Optional!!!) Maven Proxy Setup
5.1. Nexus OSS Manual Setup
5.2. Integrate Proxy with Maven
6. JBoss (Wildfly) Setup
6.1. Download and Install Wildfly 9.0.1.Final
6.2. Configure JBoss Server
6.3. Add JBoss Admin Account
6.4. Enable JBoss Remote Debugging
6.5. Define JBoss Maven Properties in settings.xml
7. H2 Database Setup
7.1. Locate the h2*.jar file
7.2. Start Server
7.3. Access DB User Interface
7.4. Activate H2 Server Profile for Builds
7.5. Update JBoss to use Server Mode
8. Eclipse Setup
8.1. Download and Install Eclipse
8.2. Define JDK location
8.3. Setup Maven Eclipse Integration (m2e)
8.4. Setup EGit Eclipse Team Provider
8.5. Setup JBoss Eclipse Integration
9. Ant Setup
9.1. Install Ant
II. JavaSE: First Simple Module Exercise
Purpose
1. Goals
2. Objectives
10. Develop and Test Module using Command Line Tools (OPTIONAL!)
10.1. Summary
11. Automate Build and Testing with Ant (OPTIONAL!)
11.1. Summary
12. Adding Logging
12.1. Summary
13. Creating Portable and Repeatable Project Builds with Maven
13.1. Summary
14. Leverage IDE using Eclipse
14.1. Import a project into Eclipse
14.2. Setup Eclipse to be able to execute Maven project goals
14.3. Setup environment to enable interactive debugging
14.4. Summary
III. Java Persistence API: Entity Manager Exercise
Purpose
1. Goals
2. Objectives
15. Setup and Start Database
15.1. Summary
16. Create Core Project POM
16.1. Summary
17. Setup Database Schema
17.1. Summary
18. Add SQL Tuning
18.1. Summary
19. JPA Persistence Unit Setup
19.1. Summary
20. Setup JPA TestCase
20.1. Summary
21. Ready Project for Import into Eclipse
21.1. Summary
22. Test EntityManager Methods
22.1. Summary
23. Automatically Generate Database Schema
23.1. Summary
24. Create JPA Parent POM
24.1. Summary
IV. Java Persistence API: Entity Mapping Exercise
Purpose
25. JPA Entity Exercise Setup
25.1. Setup Maven Project
26. JPA Entity Class Basics
26.1. Create POJO Class using descriptor
26.2. Create POJO Class using annotations
26.3. Summary
27. Mapping Class Properties
27.1. Map Entity to Specific Table
27.2. Using JPA Property Access
27.3. Summary
28. JPA Enum Mapping
28.1. Mapping Enum Ordinal Values
28.2. Mapping Enum Name Values
28.3. Mapping Enum Alternate Values
28.4. Summary
29. Mapping Temporal Types
29.1. Mapping Temporal Types
29.2. Summary
30. Mapping Large Objects
30.1. Mapping CLOBS
30.2. Mapping BLOBS
30.3. Summary
31. Primary Key Generation
31.1. IDENTITY Primary Key Generation Strategy
31.2. SEQUENCE Primary Key Generation Strategy
31.3. TABLE Primary Key Generation Strategy
31.4. Summary
32. Mapping Compound Primary Keys
32.1. Using Embedded Compound Primary Keys
32.2. Using Compound Primary Keys as IdClass
32.3. Summary
33. Mapping Embedded Objects within Classes
33.1. Mapping an Embedded Object
33.2. Mapping Muti-level Embedded Objects
33.3. Summary
34. Objects Mapped to Multiple Tables
34.1. Mapping to Secondary Tables
34.2. Summary
V. Java Persistence API: Relationship Exercise
Purpose
35. JPA Entity Exercise Setup
35.1. Setup Maven Project
36. Mapping One-to-One Relationships
36.1. Setup
36.2. One-to-One Uni-directional Relationships
36.2.1. One-to-One Uni-directional Using a Foreign Key
36.2.2. One-to-One Uni-directional Using a Join Table
36.2.3. One-to-One Uni-directional Using a Primary Key Join
36.2.4. One-to-One Uni-directional Using MapsId
36.2.5. One-to-One Uni-directional Using Composite Primary/Foreign Keys
36.3. Mapping One-to-One Bi-directional Relationships
36.3.1. One-to-One Bi-directional Joined By Primary Key
36.3.2. One-to-One Bi-directional 0..1 Owner Relationship
36.3.3. One-to-One Bi-directional 0..1 Inverse Relationship
36.4. One-to-One EntityManager Automated Actions
36.4.1. One-to-One Using Cascades From Owner
36.4.2. One-to-One Using Cascades From Inverse
36.4.3. One-to-One Using Orphan Removal
36.5. Summary
37. Mapping One-to-Many Uni-directional Relationships
37.1. Setup
37.2. One-to-Many Uni-directional
37.2.1. One-to-Many Uni-directional with Join Table
37.2.2. One-to-Many Uni-directional using Foreign Key Join (from Child Table)
37.2.3. One-to-Many Uni-directional Mapping of Simple Types using ElementCollection
37.2.4. One-to-Many Uni-directional Mapping of Embeddable Type using ElementCollection
37.3. One-to-Many Provider Actions
37.3.1. One-to-Many Orphan Removal
37.4. Summary
38. JPA Collections
38.1. Setup
38.2. Entity Identity
38.2.1. Instance Id
38.2.2. Primary Key Id
38.2.3. Switching Ids
38.2.4. Business Id
38.3. Collection Ordering
38.3.1. Ordered Collections
38.4. Collection Interfaces
38.4.1. Using Maps with Collections
38.5. Summary
39. Mapping Many-to-One, Uni-directional Relationships
39.1. Setup
39.2. Many-to-One Uni-directional
39.2.1. Many-to-One Uni-directional Using a Foreign Key
39.2.2. Many-to-One Uni-directional Using a Compound Foreign Key
39.2.3. Many-to-One Uni-directional Using a MapsId
39.3. Summary
40. Mapping One-to-Many/Many-to-One Bi-directional Relationships
40.1. Setup
40.2. One-to-Many Bi-directional using Foreign Key Join
40.3. One-to-Many Bi-directional using Join Table
40.4. One-to-Many Bi-directional using Derived Composite Primary
40.5. Summary
41. Mapping Many-to-Many Relationships
41.1. Setup
41.2. Many-to-Many Uni-directional
41.3. Many-to-Many Bi-directional
41.4. Summary
VI. Java Persistence API: Query Exercise
Purpose
42. Exercise Data Model
42.1. Class Model
42.2. Database Schema
42.3. Object Instances
43. JPA Entity Exercise Setup
43.1. Setup Maven Project
44. Creating JPA Queries
44.1. Setup
44.2. Create/Execute Query
44.2.1. Multiple Results
44.2.2. Single Result
44.2.3. Single Result - NoResultException
44.2.4. Single Result - NonUniqueResultException
44.3. Query Parameters
44.4. Paging Query Results
44.5. Named Query
44.6. Value Queries
44.6.1. Retrieve Value
44.6.2. Retrieve Function Result Value
44.6.3. Retrieve Multiple Values
44.6.4. Encapsulate Row Values with ResultClass
44.7. Summary
45. SQL Queries
45.1. Setup
45.2. Create/Execute SQL Query
45.3. SQL Query Entity Result Mapping
45.4. SQL Result Set Mapping
45.5. Summary
46. Bulk Updates
46.1. Setup
46.2. Additional Setup
46.3. Using JPQL Bulk Update
46.4. Using Native SQL Bulk Update
46.5. Summary
47. Query Locks
47.1. Setup
47.2. Additional Setup
47.3. Using No Locks
47.4. Adding Lock Mode
47.5. Using Pessimistic Write Lock
47.6. Summary
VII. Basic EJB Development Exercise
Purpose
1. Goals
2. Objectives
48. Multi-Module JavaEE Project
48.1. Purpose
48.1.1. Goals
48.1.2. Objectives
48.2. Create Root Module
48.3. Create EJB Module
48.4. Manage Application Server
48.4.1. Application Server Setup
48.4.2. Standalone Application Server
48.4.3. Embedded Application Server
48.5. Summary
49. EAR Deployment
49.1. Purpose
49.1.1. Goals
49.1.2. Objectives
49.2. Create EAR Module
49.3. Create RMI Test Module
49.4. Deploy the EAR
49.5. Lookup and Invoke @Remote Interface
49.6. EJB Client
49.7. Summary
50. WAR Deployment
50.1. Purpose
50.1.1. Goals
50.1.2. Objectives
50.2. Create WAR Module
50.3. Add RMI Test
50.4. Embed EJB in WAR Module
50.5. Summary
51. Build Commands
51.1. Purpose
51.1.1. Goals
51.1.2. Objectives
51.2. mvn (phase)
51.3. mvn (phase) -rf :module
51.4. mvn (phase) -f (path to module)
51.5. mvn clean -Pundeploy
51.6. mvn clean -Dit.test=fully.qualified.ITPath#testMethod
51.7. Summary
52. Controlling JNDI Names
52.1. Purpose
52.1.1. Goals
52.1.2. Objectives
52.2. Eliminate Version# from EAR-based JNDI Name
52.3. Eliminate Version# from WAR-based JNDI Name
52.4. Summary
53. Debug Remote EJB
53.1. Purpose
53.1.1. Goals
53.1.2. Objectives
53.2. Running IT Tests in IDE
53.3. Debugging Deployment to Standalone Server
53.4. Debugging Deployment to Embedded Server
53.5. Summary
54. EJB Parent POM
54.1. Purpose
54.1.1. Goals
54.1.2. Objectives
54.2. Create Root POM
54.3. Summary
VIII. JNDI/ENC Configuration Lab
Topics
55. Configuring EJB Using Annotation Lookups
55.1. Setup
55.2. Inject Resources
55.3. Summary
56. Configure EJB using Injection of ENC Resources
56.1. Setup
56.2. Inject Resources
56.3. Summary
57. Configuring EJB using JNDI Lookups of ENC
57.1. Setup
57.2. Inject Resources
57.3. Summary
58. Configuring EJB using Injected Resources from XML
58.1. Setup
58.2. Inject Resources
58.3. Summary
59. EJB Injection
59.1. Setup
59.2. @EJB Inject No Interface EJB
59.3. @EJB Inject Local Interface Bean
59.4. @EJB Inject Remote Interface using Lookup
59.5. Summary
IX. Implementing JPA-based EJBs and Remote Interfaces Lab
Purpose
1. Goals
2. Objectives
60. Getting Started
60.1. Start the Application Server
60.2. Build Solution
60.3. Build Exercise
60.4. Import Exercise into IDE
60.5. Summary
61. Server-side Persistence Unit
61.1. EJB Persistence Unit
61.2. Imported EJB - WAR Deployment
61.3. Embedded EJB - WAR Deployment
61.4. Summary
62. Remote Interface Issues
62.1. Serializable DTOs
62.2. Provider (Hibernate) Proxy Classes
62.3. Lazy Loading Exception
62.4. Cleansed BO/DTO
62.5. Pre-Loaded Entities
62.6. Separate DTO Classes
62.7. Summary