| Course Code: |
IN 549 |
| Course Abstract: |
This course provides participants with in-depth coverage and hands-on practical exercises using the latest features of the Spring and Hibernate frameworks. Participants will begin by learning how to configure the Spring environment, wire up beans, and implement the powerful inversion of control (IOC) features that have made Spring so popular. Participants will also learn to make use of Spring's aspect-oriented programming feature set, first by learning AOP basics and then applying those concepts within a Spring-enabled environment. The built-in Spring MVC architecture will also be explored. In addition, Spring remoting and web service features will be examined. Participants will learn how to map Java objects to relational data while exploring the transaction and persistence management features built into the Hibernate framework. Participants will examine the built-in and customizable Hibernate mapping types as well as the Hibernate Query Language (HQL), an object-oriented SQL-like querying language. Advanced Hibernate storing and fetching techniques are looked at also. Integration into the Spring Framework and into other frameworks, such as Struts, is also explored via lectures and exercises.
Upon completion of this course, participants will have developed a complete application using Spring and Hibernate-based enterprise APIs. Hands-on labs reinforce the lecture topics while providing practical experience. Emphasis is placed on the Spring IOC and AOP capabilities, Hibernate APIs, mapping features, and application integration.
Note: This course contains a number of chapters that may be emphasized or de-emphasized depending on desired topics.
|
| Audience: |
This course is designed for Java EE developers looking to explore Java's most promising open-source frameworks available today. Experience with Java EE technologies is extremely helpful in deriving the most benefit from this course, though it is not required.
|
| Duration: |
5 days |
| Learning Outcomes: |
Upon completion of this course, the participant will be able to:
> Configure a Spring-based application using XML and the ApplicationContext > Wire up beans and understand Spring's inversion of control container > Learn AOP basics and incorporate before, after, and around advice into a Spring application > Configure the Hibernate persistence service for use within an application > Incorporate various object-relational mappings and Hibernate typing > Utilize the HQL, externalize and parameterize queries > Explore the Hibernate API including transactions and caching techniques > Seamlessly integrate Hibernate into the Spring Framework by developing a sophisticated data access object and business service architecture > Utilize other Spring services including remoting, web services, and Spring MVC, Spring JavaScript and Spring Web Flow |
| Course Topics: |
Introducing Spring Problems with traditional Java EE Development What is Spring? Spring Versions and Compatibility The Traditional Development Approach Introducing Dependency Injection A First Look at Spring A Spring Example The Spring Distribution and JARs Spring Configuration The Spring Modules Exercise – Working with Spring
Inversion of Control Spring IOC Types of Dependency Injection Setter Injection Constructor Injection Injecting Beans into Other Beans (“Wiring Up” Beans) Spring Configuration files Differences between Spring 3.0, 2.5, 2.x, and 1.2.x The <bean/> Element Spring 3.0 scopes Scope vs. Singleton attributes Bean Singletons Bean Prototypes Spring BeanFactories ApplicationContext Creating the Container Building Spring Services Exercise 2 – Creating Spring Services Bean Scopes in Spring 3.0 Request and Session-scoped Beans Steps toward Spring-enabling Your Web Applications Using Request/Session-scoped beans within Singleton Services Using Placeholders Internationalization Lookup Method Injection Lazy Initialization Autowiring Controlling Bean Lifecycles Exercise – Spring-enabling the Web Application
Spring JDBC Why use Spring JDBC? What does Spring JDBC offer? JDBCTemplate JDBCDaoSupport Configuring the DataSource Building a Spring-based DAO Building a Row Mapper Retrieving a Single Object Spring JDBC Error Handling DataAccessExceptions Updates with JDBCTemplate Updates via SQLUpdate Exercise – Retrieving and Updating Objects Using Spring JDBC
Introducing Hibernate Has JDBC Failed? JPA and Hibernate 3 Choosing a Persistence Strategy Objects vs. Relations Lightweight Services vs. Heavyweight Containers How Hibernate Works Within an Application Server Persisting Plain Old Java Objects (POJOs) Introducing the Hibernate Persistence Service Getting Started with Hibernate Setting up the Environment hibernate.properties Basic Configuration and Persistence Objects Hibernate Mappings Mapping Properties Configuring the SessionFactory Maintaining the Session Factory A First Hibernate Example Performing a Query What is a Session? Returning Multiple Rows Executing Updates Insert and Delete Operations with Hibernate Configuring Log4J within Hibernate Eclipse and Hibernate Plug-ins Exercise – Displaying, Inserting, Removing Products and Orders
The Hibernate API Basic Configuration The SessionFactory A Hibernate Session The Session Interface Hibernate Exceptions The LifeCycle of a POJO Transient, Persistent, and Detached Objects Session State Methods Session Persistence Methods First-Level Caching Saving Duplicate Objects Merging Detached Objects Reattaching vs. Merging Detached Objects Checking the Cache and Evicting Loading Objects Get() versus Load() Mapping Associations Mapping Metadata XML vs. Annotations Java vs. XDoclet Annotations Java Annotations Hibernate Annotations Extensions Cascading Operations Composite Keys Exercise – Using Composite Keys and Associations
The Hibernate API – Part II The Query Interface Performing Queries Query Methods Iterating a Query Iterating vs. Lists Selecting Multiple Columns Using HQL Basic Syntax Ordering and Grouping HQL and Object Graphs Maps and Functions in HQL HQL Joins and Subqueries Named Parameters Positional Parameters Pagination Externalizing Queries Stored Procedures Lazy Loading Working with Detached Object Graphs Exercise – Using HQL, Named Parameters, and Externalized Queries
More On Hibernate Mapping Mapping Associations Many-to-One One-to-One Directionality Bi-directional Associations Collections Mapping Collection Types Many-to-many Mappings Unidirectional One-to-Many Lists One-to-Many Bags More on Types Mapping Types Hibernate and XDoclet Exercise – Querying and Updating with Many-to-Many Mappings
Integrating Frameworks and Patterns of Usage DAO Patterns Wrapping Hibernate An Abstract DAO Hibernate Spring Integration The HibernateTemplate Configuring Spring to Support Hibernate Configuring the SessionFactory within Spring Spring’s HibernateDaoSupport Class A Hybrid Spring/Hibernate DAO Using the New DAO Patterns of Usage for Hibernate Sessions in Web Apps Exercise – Using the DAO Spring Service and HibernateTemplate
Apache Struts Web Tier Integration Spring-Enabling Web Apps Spring-Enabling Struts-based Apps IOC and Struts Actions Replacing the RequestProcessor and Injecting Actions Exercise – Integrating Struts and Spring
JavaServer Faces Web Tier Integration Spring-Enabling JSF-based Web Apps Modifying faces-context.xml Incorporating Spring’s DelegatingVariableResolver Using the SpringBeanVariableResolver Controlling bean delegation between JSF and Spring Exercise – Integrating JSF and Spring Framework
Spring Integration, Web Services, and Remoting Wiring Web Services Introducing Spring Integration Implementing Web Services Using Spring-WS Creating RESTful services JMS Integration with Spring Understanding Messages and Channels Creating the Service Activator Integrating Spring and EJBs Wiring EJBs Enterprise Solutions with Spring and EJBs Remoting with Spring Created a Distributed App using Spring Remoting Exercise – Utilizing Spring Web Services
Spring JavaScript, Ajax, and DWR Serving JavaScript Resources with Spring Serving JavaScript Libraries with Spring Ajax and Spring Enabling DWR Sending Objects using DWR via Spring Exercise – Incorporating Ajax into Spring-based Apps
Appendix A - AOP Why Aspect-Oriented Programming? Programming the Spring AOP Way Common Terms Recognizing Concerns Weaving Aspects Aspect Structure Join Points Pointcuts Advice Introductions Installing AspectJ Aspects AspectJ vs. Spring AOP Exercise – Creating and Utilizing AspectJ Aspects
Appendix B - Spring AOP SpringAOP Basics Using Before Advice MethodBeforeAdvice Interface Configuring Advice Running the Client Using After Advice AfterReturningAdvice Interface Around Advice MethodInterceptor Spring AOP Proxies Client’s and the Proxy Programmatic vs. Declarative Proxies Pointcuts Spring-Provided Pointcuts Creating Pointcuts Creating Advisors Exercise – Working with Spring AOP Around Advice for Data Validation
Appendix C - Spring MVC The Spring MVC Process Spring MVC Components Spring MVC and Dependency Injection Configuring the DispatcherServlet Return of the ApplicationContext Working with Spring Controllers Defining HandlerMappings What is a ModelAndView? Configuring ViewResolvers Spring JSP Tags and Data Binding Data Validation: Jakarta Commons vs. Valang Creating a Validator Exercise – Creating the Product Spring MVC Application
Appendix D -- Introducing Spring Web Flow 2 Application Development Before Web Flow Challenges of Modeling Web Flow What is Web Flow? Spring Web Flow 1 vs. Web Flow 2 -- which to use? Introducing the Web Flow 2 Module Web Flow 2 Architecture Case Study: A Simple Event Registration Application UML State Diagram Terms and Symbols Developing the State Diagram Spring Web Flow 2 Components Spring Web Flow States Defining View-States Defining End States Transitions and Events Creating a Flow Definition Evaluating Actions and Identifying Transitions Up and Running with Spring MVC Spring MVC Configuration and Setup Testing the Flow Execution
Appendix E – Hibernate Transactions and Caching Dealing with Concurrency Hibernate Transactions Configuring Transaction Type Working with the JTA Data Isolation Issues Managing Transaction Isolation Locking Strategies Using LockMode Hibernate LockMode Object Automatic Versioning First-Level Caching Second-Level Caching Configuring and Mapping Second Level Caches Performance Exercise – Working with a Second-Level Cache |
| Prerequisites: |
Previous Java EE, XML, and Java skills are required. This course is recommended for participants who have previously had exposure to Java EE application components or are comfortable with Java SE and Java EE development principles.
|