Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Developing EJB 3 Applications for WebSphere Application Server V7 WD352 (classroom) VD352 (online) Course Abstract Course description This 5-day instructor-led course teaches students how to build Java Platform, Enterprise Edition 5 (Java EE 5) applications that use Enterprise JavaBeans (EJB) 3.0 and the Java Persistence API (JPA). Java EE 5 represents a significant evolution in the Java enterprise programming model. It provides application developers with considerable improvements that enhance the development experience and, in turn, productivity. In particular, the EJB 3.0 specification in Java EE 5 provides simplified business logic development, simplified testing and dependency management, and simplified object-relational persistence. In this course, students learn about the Java EE 5 component model and the new techniques employed in Java EE 5, such as dependency injection and annotation-based programming. Students also learn how to develop and test the supported types of EJBs (session and message-driven) and JPA entities. Finally, students gain experience with the various qualities of service provide by the EJB container such as security and transactions, how to create Web services from EJBs, and how to develop EJB clients. IBM WebSphere Application Server V7 and IBM Rational Application Developer V7.5 provide complete support for the EJB 3 specification. Hands-on exercises throughout this course give students practical experience developing EJBs with IBM Rational Application Developer V7.5 and deploying EJB-based applications to IBM WebSphere Application Server V7. General information Delivery method: Classroom or instructor-led online (ILO) Audience: This course is designed for Java developers. Learning objectives: After completing this course, students should be able to: State the purpose and value of using the Enterprise JavaBean (EJB) technology Describe the Java EE 5 application architecture Use annotation-based development for EJBs Explain the relationship between annotations in code and deployment descriptor files Define and use dependency injection and resource injection Develop and test the various types of EJBs (stateless session, stateful session, or messagedriven) and Java Persistence API (JPA) entities Use Java persistence query language (JPQL) Perform object-to-relational mappings (ORM) for persistent data Implement persistent entities with associations Integrate an application with messaging using message-driven beans Use EJB timers and interceptors Leverage container services for transaction management Create and test EJB clients Create Web services from EJBs Apply recommended practices in EJB design and implementation Use IBM Rational Application Developer V7.5 to develop and test an EJB 3 application Deploy an EJB 3-based application to WebSphere Application Server V7 IBM WebSphere Education http://www.ibm.com/websphere/education Contact us at: [email protected] Prerequisites: Before taking this course, students should have practical experience with the Java programming language. This knowledge can be gained by attending one of the following courses: WD152 or VD152, Java SE 5 Programming Fundamentals JA355 or VD155, Introduction to Java SE 5 Using Eclipse 3.2 Students should also have knowledge of database concepts such as SQL, primary and foreign keys, joins, and referential integrity. Some knowledge of Java EE Web development and Web services, and experience with Rational Application Developer or another Eclipse-based development environment, is also beneficial. Duration: 5 days Skill level: Intermediate Notes The unit and exercise durations listed below are estimates, and may not reflect every class experience. If the course is customized or abbreviated, the duration of unchanged units will probably increase. This course is an update of courses WD350 and VD350, Developing EJB 3 Applications for WebSphere Application Server. Course agenda Course introduction Duration: 30 minutes Unit 1. Java EE architecture Duration: 45 minutes Learning objectives: After completing this unit, students should be able to: Name the editions of the Java platform and state how they relate to each other Describe the multi-tier architecture of Java EE List the services and APIs provided by Java EE containers Describe some of the issues encountered when developing enterprise applications in earlier J2EE versions Explain the purpose of the Java Naming and Directory Interface (JNDI) Describe how Java EE is packaged for deployment Define data sources and resources Unit 2. Introduction to EJB 3 Duration: 45 minutes Learning objectives: After completing this unit, students should be able to: Define Enterprise JavaBeans Explain when a developer should consider using EJBs Describe the value proposition of the Java EE 5 and EJB 3.0 specifications Explain the role of annotations for EJBs Describe dependency injection Define transactions List the types of EJBs and state the purpose of each IBM WebSphere Education http://www.ibm.com/websphere/education Contact us at: [email protected] Unit 3. Session EJBs Duration: 1 hour Learning objectives: After completing this unit, students should be able to: Define session beans List reasons for using session beans Create session bean classes and interfaces Access session beans from client code Use the session context to interact with container-managed resources Use annotations with session beans Describe application bindings for session beans Explain the life cycle of session beans and use life cycle call back methods Compare stateful and stateless session beans Exercise 1. Creating your first stateless session bean Duration: 1 hour Learning objectives: After completing this exercise, students should be able to: Create a Java EE enterprise application in Rational Application Developer V7.5 Create an EJB 3 stateless session bean in the enterprise application Add a Web application to the enterprise application so that the Web application is the user interface to the enterprise application Run the application on the WebSphere Application Server V7 installation that is supplied with Rational Application Developer Unit 4. The library case study Duration: 30 minutes Learning objectives: After completing this unit, students should be able to: Describe the use cases in the case study Describe the architecture of the library application List the main components in the loan subsystem of the library application and state how they relate to each other Explain how each upcoming exercise contributes to the development of a working application Exercise 2. Preparing for the library case study Duration: 45 minutes Learning objectives: After completing this exercise, students should be able to: Use the Data perspective in Rational Application Developer to set up a connection to a database and run SQL commands on that database Use tools in Rational Application Developer to view data in a database Launch the WebSphere Application Server administrative console from Rational Application Developer, and use it to configure a data source Unit 5. Strategies for testing EJBs Duration: 30 minutes Learning objectives: After completing this unit, students should be able to: Distinguish between unit, integration, and other levels of testing List some strategies for unit testing IBM WebSphere Education http://www.ibm.com/websphere/education Contact us at: [email protected] Use JUnit 4 to unit test EJBs Describe alternative techniques for testing Exercise 3. Starting to build the library case study Duration: 1 hour Learning objectives: After completing this exercise, students should be able to: Create an enterprise archive (EAR) file and EJB projects in Rational Application Developer Create an EJB 3 stateless session bean and its business interface Import support packages into the EJB project Create JUnit 4 test cases and a JUnit 4 test suite for the session bean Test the session bean in a Java SE environment Exercise 4. Creating a stateful session EJB for the library case study Duration: 1 hour Learning objectives: After completing this exercise, students should be able to: Add an EJB 3 stateful session bean and its interface to an existing EJB module Use dependency injection to call a method on another EJB from the stateful session bean Create a Web application to test the session beans Associate an instance of the stateful session bean with an individual user of the Web application Unit 6. EJB clients Duration: 45 minutes Learning objectives: After completing this unit, students should be able to: State which types of EJB clients can be local and remote Explain the considerations for remote clients relating to remote method invocation Use annotations for dependency injection in client code State default resolution for EJB annotations List conditions where the client must use JNDI rather than dependency injection to access EJBs Handle exceptions thrown during EJB execution Create and run Java client applications Exercise 5. Developing a Java client application for the library case study Duration: 1 hour Learning objectives: After completing this exercise, students should be able to: Create a Java client application and add it to a Java enterprise application as a client JAR file Create a launch configuration to run the application client from within Rational Application Developer Use the console view to see output from the client application and the server IBM WebSphere Education http://www.ibm.com/websphere/education Contact us at: [email protected] Unit 7. Introduction to the Java Persistence API (JPA) Duration: 1 hour 30 minutes Learning objectives: After completing this unit, students should be able to: List the three areas of Java persistence Define JPA entities Show the relationship between EJB 3 architecture and the persistence layer List the requirements of entity classes Describe field and property-based access in entities List the elements of a JPA persistence provider Name the two types of entity managers Explain how to inject an entity manager into a session bean List the life cycle states of an entity bean and use the entity manager to change state Use callback methods and life cycle listeners Unit 8. Object-relational mapping with JPA Duration: 1 hour 15 minutes Learning objectives: After completing this unit, students should be able to: Select the appropriate mapping strategy Use annotations for schema and table mappings Use annotations for field and relationship mappings, including primary key classes and embedded classes Define one-to-one, one-to-many, many-to-one, and many-to-many relationships Describe some of the challenges involved in concurrency of data access Describe techniques used to manage concurrency in JPA Exercise 6. Developing the entity beans for the library case study Duration: 1 hour 15 minutes Learning objectives: After completing this exercise, students should be able to: Create a JPA project in Rational Application Developer Generate entity beans to represent existing database tables as Java objects Establish one-to-one, one-to-many, many-to-one, and many-to-many relationships between JPA entity beans Create an embeddable JPA entity bean and embed it in entity beans Use the object-relational mapping tools of Rational Application Developer Customize a persistence.xml file to use a Derby database as data source configured on WebSphere Application Server Unit 9. Java Persistence Query Language (JPQL) Duration: 45 minutes Learning objectives: After completing this unit, students should be able to: Create select, update, and delete operations on database tables in Java Persistence Query Language Explain the difference between JPQL and SQL Create and use static and dynamic queries Process the results of queries Describe the implications of bulk updates using JPQL IBM WebSphere Education http://www.ibm.com/websphere/education Contact us at: [email protected] Exercise 7. Creating session facades for the entity beans Duration: 1 hour 15 minutes Learning objectives: After completing this exercise, students should be able to: Define JPQL queries and store them in a persistence unit using annotations Use an entity manager provided by the EJB container to manipulate JPA entity bean instances Implement the session facade design pattern for JPA entity beans Perform operations on JPA entity beans by invoking methods of the session facade Unit 10. Message-driven beans Duration: 1 hour Learning objectives: After completing this unit, students should be able to: Explain how messaging middleware decouples sender and receiver Provide an example of sending a JMS message Give an overview of the Java Message Service (JMS) API Define message-driven beans (MDBs) List reasons for using message-driven beans Describe the role of message-driven beans in an application Show the life cycle of an MDB Create an MDB that consumes a message Describe programming rules for MDB classes Show the MDB-specific annotations Configure WebSphere Platform Messaging in WebSphere Application Server Exercise 8. Adding a message-driven bean to the library case study Duration: 1 hour Learning objectives: After completing this exercise, students should be able to: Configure WebSphere Platform Messaging, including setting up an activation specification for the MDB Write JMS code to send a message to a configured message queue Write an MDB that receives a message and then acts appropriately Test the message producer and the MDB Exercise 9. Importing a Web user interface for the library case study Duration: 1 hour Learning objectives: After completing this exercise, students should be able to: Import a Web application and add it to the library enterprise application Create a helper class to access the stateless and stateful session beans from nonmanaged classes in the Web tier Add code to ensure that each Web client uses a separate instance of the stateful session bean Run the library application using its final Web user interface Unit 11. Managing transactions in EJBs Duration: 1 hour 15 minutes Learning objectives: After completing this unit, students should be able to: IBM WebSphere Education http://www.ibm.com/websphere/education Contact us at: [email protected] Specify transaction demarcation and propagation in session and message-driven beans Compare container-managed and bean-managed transactions Describe the EJB transaction model Handle exceptions thrown in transactional contexts Describe transactional support for resources that support local and global (XA) transactions Compare the relationship between bean- or container-managed entity managers and bean- or container-managed transactions for JPA entities Exercise 10. Adding transactional integrity to the library case study Duration: 1 hour Learning objectives: After completing this exercise, students should be able to: Identify potential shortfalls of the default EJB transaction management when multiple resource managers participate in one logical unit of work Use transactional attributes to override the default transaction demarcation in EJB methods Unit 12. EJB 3 timers and interceptors Duration: 1 hour Learning objectives: After completing this unit, students should be able to: Describe the EJB timer service Describe how to set up and use timers Describe recommended practices and limitations of timers Describe interceptors and their role in aspect-oriented programming Describe strategies for implementing interceptors Exercise 11. Adding an EJB timer to the library case study Duration: 1 hour Learning objectives: After completing this exercise, students should be able to: Add EJB timer support to a stateless session bean Implement a method that initiates a timer, and a method that cancels a timer Implement a method to be notified when a timer expires Write servlets to test a timer Unit 13. EJBs and Web services Duration: 45 minutes Learning objectives: After completing this unit, students should be able to: Define the characteristics and purpose of Web services List the approaches to developing Web services Explain why exposing EJBs as services is beneficial in service-oriented architectures Describe the annotations used in an EJB Web service Expose a session bean as a Web service Exercise 12. Creating a Web service from a stateless session bean (optional) Duration: 30 minutes Learning objectives: After completing this exercise, students should be able to: IBM WebSphere Education http://www.ibm.com/websphere/education Contact us at: [email protected] Create a Web service interface for an EJB 3 stateless session bean Test the application running on WebSphere Application Server V7 using the Web Services Explorer Unit 14. EJB security Duration: 1 hour Learning objectives: After completing this unit, students should be able to: Position the capabilities of EJB security within the larger context of security Describe facilities of WebSphere Application Server for security State the responsibility of the bean provider and application assemblers with respect to security Explain EJB role-based security Compare programmatic and declarative security Exercise 13. Implementing EJB security for the library case study Duration: 1 hour Learning objectives: After completing this exercise, students should be able to: Enable administrative and application security on the server Configure the built-in user registry provided by WebSphere Application Server V7.0 for users of the library application Review Web application security settings Implement EJB role-based security on the session beans in the library application Implement programmatic security using an interceptor Test the application with security enabled Unit 15. Recommended practices for EJB 3 Duration: 1 hour Learning objectives: After completing this unit, students should be able to: State criteria for using EJB, and when to use each type of bean List guidelines for quality of service settings (transaction, security, and so forth) Explain common design patterns for EJB Unit 16. Deployment to WebSphere Application Server V7 Duration: 45 minutes Learning objectives: After completing this unit, students should be able to: Describe the WebSphere Application Server family Explain how WebSphere Application Servers support Java EE applications and extensions to the Java EE standard Name tools for assembling enterprise applications Use the WebSphere administrative console to configure resources used by enterprise applications Use the WebSphere administrative console to manage enterprise applications Locate configuration and log files for server profiles IBM WebSphere Education http://www.ibm.com/websphere/education Contact us at: [email protected] Exercise 14. Deploying the library case study (optional) Duration: 45 minutes Learning objectives: After completing this exercise, students should be able to: Export a Java enterprise application from Rational Application Developer to an enterprise archive (EAR) file that contains an assembled and ready-to-install application Navigate folders that make up an installation of WebSphere Application Server to see how utility scripts, log files, server profiles, runtime libraries, configuration files, and other features of a server are organized on the file system Run various command-line scripts, including startserver, stopserver, and serverstatus Access the administrative console from a Web browser and use it to install and start a Java enterprise application Test the library enterprise application outside Rational Application Developer Unit 17. Course summary Duration: 10 minutes Learning objectives: After completing this unit, students should be able to: Explain how the course met its learning objectives Submit an evaluation of the class Identify other WebSphere Education courses related to this topic Access the WebSphere Education Web site Locate appropriate resources for further study Appendix A. Inheritance with JPA entities (optional) Duration: 20 minutes Learning objectives: After completing this unit, students should be able to: Use entity beans in inheritance hierarchies Describe strategies for mapping inheritance relationships to database tables Explain the purpose of a mapped superclass IBM WebSphere Education http://www.ibm.com/websphere/education Contact us at: [email protected]