Spring/Hibernate Accelerated Workshop

Similar documents
SPRING INTERVIEW QUESTIONS

Enterprise Application Development In Java with AJAX and ORM

Core Java+ J2EE+Struts+Hibernate+Spring

The Spring Framework: An Open Source Java Platform for Developing Robust Java Applications

Module Title: : Cloud Application Development

Java EE 7: Back-End Server Application Development

OUR COURSES 19 November All prices are per person in Swedish Krona. Solid Beans AB Kungsgatan Göteborg Sweden

PERFORMANCE EVALUATION OF JAVA OBJECT-RELATIONAL MAPPING TOOLS HASEEB YOUSAF. (Under the Direction of John A. Miller)

Enterprise JavaBeans 3.1

Das Spring Framework - Einführung in leichtgewichtige J2EE Architektur. Jürgen Höller. Organized by:

Java EE Web Development Course Program

Framework Adoption for Java Enterprise Application Development

Course Number: IAC-SOFT-WDAD Web Design and Application Development

Customer Bank Account Management System Technical Specification Document

Beginning POJOs. From Novice to Professional. Brian Sam-Bodden

Oracle WebLogic Server 11g Administration

Performance Evaluation of Java Object Relational Mapping Tools

Research Article. ISSN (Print) *Corresponding author Lili Wang

MA-WA1920: Enterprise iphone and ipad Programming

Specialized Programme on Web Application Development using Open Source Tools

Rapid Application Development. and Application Generation Tools. Walter Knesel

Spring 3.1 to 3.2 in a Nutshell. Sam Brannen Senior Software Consultant

JBS-102: Jboss Application Server Administration. Course Length: 4 days

COMPARISON BETWEEN SPRING AND ASP.NET FRAMEWORKS

Java Building Web Apps with Spring Rob Harrop, Interface21 Ltd.

Journal of Chemical and Pharmaceutical Research, 2015, 7(3): Research Article

WEB APPLICATION DEVELOPMENT. UNIT I J2EE Platform 9

Programma corso di formazione J2EE

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

Weaving Stored Procedures into Java at Zalando

White Paper: 1) Architecture Objectives: The primary objective of this architecture is to meet the. 2) Architecture Explanation

OpenShift is FanPaaStic For Java EE. By Shekhar Gulati Promo Code JUDCON.IN

How To Write A Web Framework In Java

Spring Data JDBC Extensions Reference Documentation

This training is targeted at System Administrators and developers wanting to understand more about administering a WebLogic instance.

A Guide to Migrating Enterprise Applications to Spring

Performance Comparison of Persistence Frameworks

Specialized Programme on Web Application Development using Open Source Tools

Java SE 8 Programming

GlassFish v3. Building an ex tensible modular Java EE application server. Jerome Dochez and Ludovic Champenois Sun Microsystems, Inc.

Agile Best Practices and Patterns for Success on an Agile Software development project.

Aspect Oriented Programming. with. Spring

Complete Java Web Development

Oracle Application Development Framework Overview

CERTIFIED MULESOFT DEVELOPER EXAM. Preparation Guide

Operations and Monitoring with Spring

Architecture Rules Enforcement and Governance Using Aspects

Developing modular Java applications

Japan Communication India Skill Development Center

Java Platform, Enterprise Edition (Java EE) From Yes-M Systems LLC Length: Approx 3 weeks/30 hours Audience: Students with experience in Java SE

APAC WebLogic Suite Workshop Oracle Parcel Service Overview. Jeffrey West Application Grid Product Management

Inside the Digital Commerce Engine. The architecture and deployment of the Elastic Path Digital Commerce Engine

EclipseLink. Solutions Guide for EclipseLink Release 2.5

IBM WebSphere Server Administration

Client-Server Architecture & J2EE Platform Technologies Overview Ahmed K. Ezzat

JAVA/J2EE DEVELOPER RESUME

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

Efficient Monitoring of OSGi Applications

Eclipse 4 RCP application Development COURSE OUTLINE

The end. Carl Nettelblad

Wireless Web Content Management Using J2ME

How To Write An Online Shopping Application In Java Ee

Oracle WebLogic Server 11g: Administration Essentials

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

Communiqué 4. Standardized Global Content Management. Designed for World s Leading Enterprises. Industry Leading Products & Platform

Copyright 2014 Jaspersoft Corporation. All rights reserved. Printed in the U.S.A. Jaspersoft, the Jaspersoft

Aspect-oriented Refactoring of a J2EE Framework for Security and Validation Concerns

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:

JAVA ENTERPRISE IN A NUTSHELL. Jim Farley and William Crawford. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo.

Course 6234A: Implementing and Maintaining Microsoft SQL Server 2008 Analysis Services

Course Name: Course in JSP Course Code: P5

WebSphere Server Administration Course

SharePoint Training DVD Videos

Pro<DOC/> e-commerce Technology An Introduction

Java SE 7 Programming

Java SE 7 Programming

PROGRAMMERS GUIDE. Version 1.x

FUSE-ESB4 An open-source OSGi based platform for EAI and SOA

Administering batch environments

How To Write A Nosql Database In Spring Data Project

Diagnosing Production Java Applications Madhav Sathe

Nicholas S. Williams. wrox. A Wiley Brand

Best Practices for Programming Eclipse and OSGi

Implementing and Maintaining Microsoft SQL Server 2005 Reporting Services COURSE OVERVIEW AUDIENCE OUTLINE OBJECTIVES PREREQUISITES

Japan Communication India Skill Development Center

Rational Application Developer Performance Tips Introduction

Oracle Database: Program with PL/SQL

Java DB2 Developers Performance Best Practices

Java Application Performance

Building Web Applications, Servlets, JSP and JDBC

Spring Security 3. rpafktl Pen source. intruders with this easy to follow practical guide. Secure your web applications against malicious

rpaf KTl Pen source Alfresco 3 Records Management Comply with regulations and secure your organization's records with Alfresco Records Management

Converting Java EE Applications into OSGi Applications

Oracle BI 11g R1: Build Repositories

3 Techniques for Database Scalability with Hibernate. Geert Bevin - SpringOne 2009

Server-side OSGi with Apache Sling. Felix Meschberger Day Management AG 124

CatDV Pro Workgroup Serve r

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

mframe Software Development Platform KEY FEATURES

NextRow - AEM Training Program Course Catalog

Transcription:

Spring/Hibernate Accelerated Workshop About this Accelerated Workshop This intensive 5-day, 12-hour per day workshop combines our 3-day Hibernate 3.0 course and our 3 day Spring 2.5 course along with a capstone Spring/Hibernate integration project. This workshop makes uses of Eclipse as the IDE, Apache Derby as the DBMS, and Apache Tomcat as the web container. The workshop begins by introducing you to everything you need to know to begin working with Hibernate. It covers all the important concepts necessary to access and update data stored in relational databases. It includes an extensive series of labs to exercise all major capabilities of Hibernate. The workshop then covers Spring with in-depth coverage on using the powerful capabilities of the Core module to reduce coupling, increase flexibility and ease the maintenance and testing of your applications. The workshop goes on to cover important capabilities of Spring, including using Spring to simplify the creation of a persistence layer with JDBC and Hibernate, and using Spring's Aspect Oriented Programming (AOP) to program cross-cutting concerns such as transactions and security. The workshop then covers the basics of Spring MVC, and how it supports organizing your Web applications in a highly structured, loosely coupled manner. Finally, your knowledge is challenged and expanded through an integrated capstone exercise that requires you to build a Java enterprise application that features both Spring and Hibernate. About the technologies: Hibernate is an open source object/relational (OR) persistence and query service for Java. Hibernate hides tedious database access code behind plain old Java objects (POJOs). This allows you to simply interact with the POJOs without knowledge of the underlying JDBC details. Spring is a lightweight Java framework for building enterprise applications. Its Core module allows you to manage the lifecycle of your objects, and the dependencies between them, via configuration metadata and Dependency Injection. Its advanced capabilities provide support for Aspect-Oriented Programming, integration with Java Web technologies, security, transactions, and more. Spring does not define its own persistence framework. Instead, developers integrate OR technologies such as Hibernate, with Spring to provide persistence to their enterprise Java applications. Course Objectives: Understand the Hibernate architecture. Create Hibernate-based applications. Use Hibernate mapping to map persistent objects to the database. Work with collections and associations. Utilize Hibernate s versioning support. Map inheritance hierarchies using Hibernate. Work with Hibernate queries, HQL, and Criteria. Tune your Hibernate applications. Understand Hibernate transaction support. Describe the relationship between Hibernate and the Java Persistence API (JPA) Understand the core principles of Spring, and of Dependency Injection (DI). Use the Spring Core module and DI to configure and wire application objects (beans) together. Batky-Howell, LLC 1

Use the capabilities of the Core module, such as lifecycle events, bean scopes, and the Spring API. Work with the DAO and/or ORM modules to create a well structured persistence layer with JDBC and Hibernate. Use Spring 2.0's powerful new AOP capabilities for programming cross-cutting concerns across multiple points in an application. Use Spring's transaction support, including Spring 2.0's easy to use tx/aop XML configuration elements, and Java 5 annotations. Build well-structured Web applications with Spring MVC. Secure Web applications and Spring managed beans with Spring Security Audience: Experienced Java developers who need to work with Spring and Hibernate based applications. Prerequisites: Knowledge of relational databases, Java, JDBC, and Servlets/JSP is recommended. Number of Days: 5, 12-hour days 1. Hibernate Overview The Issues with Persistence Layers Object-Relational Mapping (ORM) Issues Issues with JDBC Alone Hibernate Overview Hibernate Benefits Hibernate Environments Hibernate Architecture More Detailed Architecture 2. Using Hibernate Acquiring Hibernate Using Hibernate Configuring Hibernate hibernate.cfg.xml Elements SessionFactory Configuration SessionFactory Configuration Properties The Configuration Class The SessionFactory Interface SessionFactory API The Session Interface Sessions and Transactions 3. Mapping a Simple Class Persistent Entity Classes Persistent Classes The Event Class The id Property The Hibernate Mapping File The <hibernate-mapping> Element The <class> Element The EVENTS Table Mapping the id Property with <id> More About Primary Keys Generating the id Value Mapping Properties with <property> Hibernate Mapping Types Common Hibernate Type Mappings Filed Access or Property Access The Mapping File Hibernate Sessions The Session Interface Retrieving Persistent Objects 4. Logging Hibernate.show_sql Apache Log4J Hibernate log4j.properties File The log4j.properties File Modifying log4j.properties for Hibernate Hibernate Logging Categories 5. Appendix Log4J Apache Log4J log4j Loggers Batky-Howell, LLC 2

Logger Hierarchy Logger Levels Appenders Appender Additivity 6. Layout log4j Configuration File PatternLayout Multiple Layouts Some log4j Appenders 7. Inserting and Updating Inserting Instances Modifying a Persistent Instance Deleting an Instance 8. Querying and Hibernate Query Language (HQL) Hibernate Query Language HQL Basics Executing a Query Other Common Query Methods Where Clause/Restriction HQL Operators and Expressions Query Parameters Using Query Parameters Named Queries Projection Queries Projection Queries Returning Tuples Additional Query Capabilities Aggregate Functions 9. Transaction Definition Transaction Lifecycle Transactions Modularize Systems Transactions Clarify Systems 10. Hibernate and Transactions Hibernate and Transactions Hibernate Transaction Demarcation Working with Transactions The Hibernate Transaction API Working in a Managed Environment 11. The Persistence Lifecycle Hibernate Object States Transient and Persistent State Detached and Removed State Hibernate Object States and Transitions The Persistence Context Session/Persistence Context Lifespan Session-per-Request Session Propagation First Acquiring a SessionFactory Instance Contextual Session Using Contextual Sessions What is the Current Context Contextual Session Scope The Persistence Context as Cache Synchronization to the Database Flushing the Session Persistence Context and Object Identity Yes, It s Complicated 12. Versioning and Optimistic Locking Detached Objects and Optimistic Locking Using a Detached Instance Optimistic Locking and Versioning Version Property in Java Class Version Element in Mapping File Automatic Version Maintenance Updating a Detached Instance session.saveorupdate() The unsaved-value Attribute Locking Objects Lock Modes 13. Relationships Overview Object Relationships Characteristics of Relationships Directionality Characteristics of Relationships 14. Collections of Value Objects Collections of Values Modeling a Set of Values Mapping the Set of Values Using a Set of Values More on the Java Collection Type Using the Java Collection Types Modeling a List of Values Mapping a List of Values Sorted and Ordered Collections Collections of Components Batky-Howell, LLC 3

Mapping Collections of Components 15. Mapping Entity Relationships Unidirectional Many-To-One Relationship The Table Structure Many-To-One Mapping the Relationship Using the Relationship Bidirectional One-To-Many Relationship Defining the One-To-Many Relationship Mapping the One-To-Many Relationship More on the Inverse Side Cascading Operations Transitive Persistence The Cascade Attribute Cascade Choices Choosing Cascade Options Bidirectional One-To-One Relationship Mapping a One-To-One Relationship Many-To-Many Relationship Defining Many-To-Many Relationship Mapping Many-To-Many Relationship Lazy and Eager Loading Queries Across Relationships OUTER and FETCH JOIN 16. Mapping Inheritance Inheritance Entity Inheritance Details of Entity Inheritance Single-Table Strategy Class Definitions for Single-Table Mapping for Single-Table Single-Table: Pros and Cons Table per Subclass (Joined Subclass) Mapping for Table per Subclass Joined: Pros and Cons Table per Concrete Class 17. More on Querying Projection Queries Aggregate Queries Bulk Update and Delete Executing Bulk Operations Native SQL Queries Refining SQL Queries Retrieving Entities with SQL Queries 18. Filters Hibernate Filters Defining and Attaching Filters Using a Filter Mapping a Filter to a Set Collection Filters 19. Criteria Restrictions Narrowing the Result Set Restrictions Methods Navigating Associations Eager Fetching Query by Example Refining the Example Additional Capabilities 20. JPA Overview Java Persistence API Overview Java Persistence Environments Hibernate and JPA 21. Mapping a Simple Class Entity Classes Event Entity Mapped with JPA The Entity Declaration The Event Class The id Property Mapping Properties Basic Mapping Types 22. Entity Manager and Persistence Context The Entity Manager & Persistence Context Persistence Unit persistence.xml Acquiring an EntityManager Working with Transactions Retrieving Persistent Objects 23. Inserts and Queries Persisting a New Entity Java Persistence Query Language Executing a Query WHERE Clause and Query Parameters Named Queries Version Property in Java Class Versioned Class and Detached Objects 24. Relationships Batky-Howell, LLC 4

JPA Support for Relationship Mapping the Many-To-One Relationship 25. Mapping the One-To-Many Relationship Loading and Cascading Queries Across Relationships Inheritance Entity Definitions for Single-Table Entity Definitions for Joined 26. Components and Multi-Table Mapping Component Overview Mapping a Component Multi-Table Mapping 27. equals() and hashcode() Defining equals() and hashcode() Redefining equals() 28. Caching Second-Level Cache Data Appropriate for Caching Cache Providers Configuring Caching Concurrency Strategies Managing the Caches 29. Design Considerations Long Conversations Session-per-Conversation Problems with Web Applications Open Session in View Pattern Query Efficiency Techniques Beware of N+1 Select Issue Prefetching Data in Batches Data Access Object (DAO) 30. Hibernate Toolset Hibernate Tools Overview Important Note on Versions Optional Hibernate Tools Install Hibernate Tools Hibernate Console Configuration Hibernate Console Perspective Hibernate Configuration View Class Diagram HQL Editor Query Results Properties View SQL Preview Other Capabilities 31. Introduction to Spring The Challenge of Enterprise Applications Shortcomings of Java/Java EE What is Spring? The Spring Components The Spring Distribution Spring Introduction Managing Beans A Basic Spring Application Some Bean Classes Configuration Metadata Declaring Beans The Spring Container Working with Spring Why Bother? Some Important BeanFactory Methods Dependencies and Dependency Injection Dependencies Between Objects Dependency Inversion Principal Dependency Injection (DI) in Spring Dependency Injection Configuration Advantages of Dependency Injection Dependency Injection Reduces Coupling 32. More about Bean Properties Working with Properties Configuring Value Based Properties Using Value Based Properties Property Conversions Constructor Injections Constructor Argument Resolution Setter Injection vs. Constructor Injection Collection Valued Properties Working with Collections Configuring <list> and <set> Properties Batky-Howell, LLC 5

Configuring Collections of Bean References Map Valued Properties java.util.properties Valued Properties Additional Capabilities Factory Methods Instance Factory Methods Bean Aliases Bean Definition Inheritance Autowiring Autowiring bytype Pros and Cons of Autowiring To Autowire or Not to Autowire 33. The Spring Container and API ApplicationContext ApplicationContext Interface ApplicationContext Implementations Constructors Using an ApplicationContext Spring Resource Access Built-in Resource Implementations Bean Scope and Lifecycle Bean Scope Specifying Bean Scope Inner Beans Compound Names Depends On Bean Creation Lifecycle Bean Creation Lifecycle Details Using the Lifecycle Interfaces for Beans Bean Destruction Lifecycle BeanPostProcessor Event Handling MessageSources Issues with Messages Resource Bundles Defining Resource Bundles Using Resource Bundles and MessageSource Localization/Internationalization Paramaterizing Messages Annotation Driven Configuration Annotations in Spring Enabling Spring Annotations DI Using @Resource @Resource Additional Uses @Component and Auto- Detecting Beans Complete Declarations Using Annotations Other Stereotype Annotations Lifecycle Annotations XML Config Annotations and Scanning Annotation Configuration Pro/Con A Note on the XML Configuration A Brief Note on Annotations 34. Database Access with Spring Issues with JDBC Problems Using JDBC Directly Let s Review Some Simple JDBC Usage Simple Query on the Database Problems with the Previous Approach Spring Support for the DAO Pattern Spring DAO Support The Spring Database API The JdbcTemplate Class The JdbcDaoSupport Class 35. DataSources Spring Jdbc Exception Hierarchy DAO Based on Spring Classes Configuring a DataSource Looking up a DataSource in JNDI Building a DAO Without the Support Class Queries and Updates Querying with JdbcTemplate Mapping Result Rows to Objects Defining a RowMapper Class Inserting/Updating SimpleJdbcTemplate The SimpleJdbcTemplate Class The SimpleJdbcDaoSupport Class Querying with SimpleJdbcTemplate Batky-Howell, LLC 6

Defining a ParameterizedRowMapper Inserting/Updating Using Spring with Hibernate Hibernate Overview Typical Hibernate Configuration File Using Hibernate Directly Spring Support for Hibernate HibernateTemplate LocalSessionFactoryBean HibernateDaoSupport Configuring a Hibernate DAO Querying with HibernateTemplate UsingHibernateCallback Contextual Sessions Spring Free DAO What Approach to Use Support for Java Persistence API (JPA) 36. Aspect Oriented Programming (AOP AOP Overview The Issue with Crosscutting Concerns Crosscutting Illustrated Aspect Oriented Programming (AOP) Defined Spring AOP Introduction Spring AOP with AspectJ Annotations Defining an Aspect with @AspectJ Defining a Pointcut Defining Advice Configuring Spring A Program that Triggers Advice More on How Spring AOP Works Pointcut Expressions and Advice Pointcut Expressions Sample Execution Designator Patterns Other Designators Available in Spring AOP Combining Pointcut Expressions Kinds of Advice A Brief Note on Annotations Annotation Definition Using Annotations XML Based AOP Support Defining Aspects Using XML Specifying Advice with XML Other Considerations Spring Proxies and Direct Invocation More on Spring Proxies Issues with AOP Is AOP Worth It Other AOP Capabilities and Functionality 37. Transactions Transaction Managers Configuring Transaction Managers JTA Transaction Manager Spring Declarative Transaction Management Transactional Scope Transaction Attributes for Propagation MANDATORY NESTED NEVER NOT_SUPPORTED REQUIRED REQUIRES_NEW SUPPORTS Transaction Attributes Some Choices Specifying Transaction Attributes Additional Transactional Attributes Rolling Back and Exceptions XML Configuration Linking Advice with Pointcuts <tx:method> Attributes 38. Spring and the Web Integration with Java EE Spring and Java EE Java EE Web Applications Web Application Structure Web Application Components ApplicationContext and Web Apps Configuring ContextLoaderListener Using the Application Context Spring MVC Basics What is Spring MVC? MVC Architecture Batky-Howell, LLC 7

MVC Pattern Flow Spring MVC Architecture Simple Search App Model Servlets/JSP Simple Search App Model Spring MVC DispatcherServlet DispatcherServlet Initialization Command Controllers Very Simple Command Controller 39. Configuring the Command Controller Forms and View Resolvers View Resolvers A JavaBean Command Class Working with Forms Defining a FormController Configuring a FormController The Response View HandlerMappings Spring MVC Form Tags Rendering the Form via Spring MVC Flow for Rendering Form Initializing the Form Form Initialized and Rendered Annotation-Based Configuration Controller and Request Annotations Annotations and Forms Annotations and Form Initialization 40. Spring Security Overview Spring Security Spring Web Security web.xml Spring Web Security Spring Configuration More <http> Capabilities Other Authentication Providers Method Security Method Security Annotations Method Security Pointcut Expressions Method Security XML Configuration 41. Capstone Exercise 4 to 6 hour Spring/Hibernate Lab Batky-Howell, LLC 8