You are previewing Spring Persistence: A Running Start.
O'Reilly logo
Spring Persistence: A Running Start

Book Description

Published with the developer in mind, firstPress technical briefs explore emerging technologies that have the potential to be critical for tomorrow's industry. Apress keeps developers one step ahead by presenting key information as early as possible in a PDF of 150 pages or less. Explore the future through Apress with Spring Persistence—A Running Start.

This firstPress title gets readers rolling with the various fundamental Spring Framework Java Persistence concepts and offerings, as well as proven design patterns for integrating Spring Persistence functionality for complex and transaction-based enterprise Java applications.

The Java platform offers several options for saving "long-lived" information, including JPA (Java Persistence API), Hibernate, iBatis, JDBC, and even JCR (Java Content Repository—a standard for interfacing with a content management system).

This book helps readers decide which persistence solution is the most ideal for their application requirements, and shows how Spring can be leveraged to simplify the integration of their selected persistence framework into their enterprise application.

Table of Contents

  1. Copyright
  2. Spring Persistence: A Running Start
  3. Acknowledgements
  4. 1. Introducing Spring Persistence
    1. 1.1. Persistence
    2. 1.2. Spring as a de Facto Standard
      1. 1.2.1. Spring and JavaBeans
      2. 1.2.2. Inversion of Control and Dependency Injection
    3. 1.3. Exploring Spring Design Patterns and Strategies
      1. 1.3.1. The Spring Life Cycle
      2. 1.3.2. An Overview of Handy Spring Interfaces
    4. 1.4. Injecting Code Using AOP and Interceptors
      1. 1.4.1. Code Weaving to Inject Functionality
      2. 1.4.2. Using Declarative Transactions
    5. 1.5. Application Layering
      1. 1.5.1. The Domain Model Layer
      2. 1.5.2. The DAO Layer
      3. 1.5.3. The Service Layer
    6. 1.6. Understanding Your Persistence Options
    7. 1.7. Summary
  5. 2. Using Spring JDBC
    1. 2.1. Integrating JDBC into Your Application Using Spring
    2. 2.2. Integrating Datasources with Spring JDBC
    3. 2.3. Creating an ApplicationContext
    4. 2.4. Using Singleton Beans
    5. 2.5. Integrating a Database
    6. 2.6. Adding Persistence
      1. 2.6.1. Using the Template Pattern for Persistence
      2. 2.6.2. Working with the Spring JDBCTemplate
      3. 2.6.3. Using RowMapper
      4. 2.6.4. Implementing Our DAO Interface
    7. 2.7. Using the SimpleJdbc Classes
    8. 2.8. Updating and Executing via JdbcTemplate
      1. 2.8.1. Handling Binary Data
    9. 2.9. Other JdbcTemplate Implementatons
    10. 2.10. Summary
  6. 3. Using Spring with Hibernate
    1. 3.1. Migrating Our Gallery Application to Hibernate
      1. 3.1.1. Defining the Associations
    2. 3.2. Building the Comment and ArtEntity Java Classes
      1. 3.2.1. Exploring the Annotations
      2. 3.2.2. Using Cascading Options to Establish Data Relationships
      3. 3.2.3. Lazy Loading with Hibernate
    3. 3.3. Rounding Out the Domain Model
      1. 3.3.1. Using Polymorphism with Hibernate
      2. 3.3.2. Adding the ArtData Base Class
    4. 3.4. Building the DAOs
      1. 3.4.1. Building the Hibernate DAO Layer Using Spring
      2. 3.4.2. Enabling Query Caching with the HibernateTemplate
      3. 3.4.3. Creating Our Category DAO Implementation
      4. 3.4.4. Using HQL Queries
    5. 3.5. Persisting Data with Hibernate
      1. 3.5.1. Using import Statements
      2. 3.5.2. Managing Transactions
      3. 3.5.3. Defining the Service Facade Layer
    6. 3.6. Summary
  7. 4. Integrating JPA with Spring
    1. 4.1. Considering Configuration Options
    2. 4.2. Creating Your First JPA Application
      1. 4.2.1. @Entity
      2. 4.2.2. Using EntityManager in CRUD Operations
      3. 4.2.3. Configuring JPA and Spring
    3. 4.3. Unit Testing JPA and Spring
    4. 4.4. Summary
  8. 5. Introducing the iBATIS Data Mapper
    1. 5.1. Getting to Know iBATIS
    2. 5.2. Getting Started with iBATIS
      1. 5.2.1. Setting Up the SQL Map File
      2. 5.2.2. Writing the DAO
      3. 5.2.3. Configuring Spring
      4. 5.2.4. Configuring SQL Map
    3. 5.3. Moving Beyond the Basics
      1. 5.3.1. Mapping Results
      2. 5.3.2. Using Dynamic SQL
      3. 5.3.3. Caching
      4. 5.3.4. Managing Transactions
    4. 5.4. Summary
  9. 6. Managing Transactions
    1. 6.1. The Joy of ACID
      1. 6.1.1. Controlling the ACID Problem
      2. 6.1.2. Platform Transaction Management
      3. 6.1.3. Declarative Transaction Management
      4. 6.1.4. Using @Transactional for ACID Transactional Annotations
      5. 6.1.5. XML-Driven Transaction Configuration
    2. 6.2. Examining Transactional Examples
      1. 6.2.1. Creating a Batch Application
      2. 6.2.2. Using Two Datasources
    3. 6.3. Summary
  10. 7. Integration Testing with JUnit
    1. 7.1. Integration Testing
    2. 7.2. Using JUnit 4.4 and Annotations to Facilitate Testing
    3. 7.3. Spring JUnit 4 Extensions
    4. 7.4. Testing with a Database
    5. 7.5. Summary
  11. 8. Using Spring with a Content Management System
    1. 8.1. Introducing JCR
    2. 8.2. Introducing Spring Modules
    3. 8.3. Architecting Your Repository
      1. 8.3.1. Defining the JCR Data Model
      2. 8.3.2. Getting Started with JCR
    4. 8.4. Querying for JCR Nodes
    5. 8.5. Defining Our Service Layer
    6. 8.6. Summary
  12. 9. Rapid Web Development Using Groovy and Grails
    1. 9.1. Getting Grails Running
      1. 9.1.1. Exploring the Grails Application Directory Structure
      2. 9.1.2. Booting Up
      3. 9.1.3. Configuring Your Application
      4. 9.1.4. Configuring Your Datasource
      5. 9.1.5. Mapping URLs
    2. 9.2. Exploring the Grails Application Layers
      1. 9.2.1. Defining Your Domain Model
      2. 9.2.2. Defining Constraints and Validation
      3. 9.2.3. Customizing Domain Class Hibernate Mappings
    3. 9.3. Using Active Record as an Alternative to the DAO
    4. 9.4. Understanding the Active Record Pattern
      1. 9.4.1. Looking Under the Hood of GORM
    5. 9.5. Getting to Know Groovy
      1. 9.5.1. Letting Your Types Loose
      2. 9.5.2. Using GStrings: Strings on Steroids
    6. 9.6. Using Default Constructors in Groovy
      1. 9.6.1. Using Closures in Groovy
      2. 9.6.2. Working with Dynamic Finder Methods
      3. 9.6.3. Creating Advanced Query Methods
      4. 9.6.4. Using the Criteria API
      5. 9.6.5. Handling Associations in Grails
      6. 9.6.6. Scaffolding Your Grails Application
      7. 9.6.7. Building and Running Your Application
    7. 9.7. Defining a Transactional Service Layer in Grails
      1. 9.7.1. Generating a Service Class
    8. 9.8. Summary
  13. Related Titles