You are previewing Pro Spring 3.

Pro Spring 3

Cover of Pro Spring 3 by Clarence Ho Published by Apress
  1. Title
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Authors
  6. About the Technical Reviewer
  7. CHAPTER 1: Introducing Spring
    1. What Is Spring?
    2. The Spring Project
    3. Alternatives to Spring
    4. Summary
  8. CHAPTER 2: Getting Started
    1. Obtaining the Spring Framework
    2. Understanding Spring Packaging
    3. Analyzing Spring Dependencies
    4. The Sample Applications
    5. Spring Documentation
    6. Putting a Spring into “Hello World!”
    7. Summary
  9. CHAPTER 3: The Sample Application
    1. Requirements of the SpringBlog Application
    2. Summary
  10. CHAPTER 4: Introducing IoC and DI in Spring
    1. Inversion of Control and Dependency Injection
    2. Types of Inversion of Control
    3. Inversion of Control in Spring
    4. Dependency Injection with Spring
    5. Configuring ApplicationContext
    6. Resolving Dependencies
    7. Autowiring Your Bean
    8. Bean Inheritance
    9. Summary
  11. CHAPTER 5: Spring Configuration in Detail
    1. Spring’s Impact on Application Portability
    2. Bean Life-Cycle Management
    3. Making Your Beans “Spring Aware”
    4. Use FactoryBeans
    5. JavaBeans PropertyEditors
    6. More Spring ApplicationContext Configuration
    7. Configuration Using Java Classes
    8. Profiles
    9. Environment and PropertySource Abstraction
    10. Configuration Using JSR-330 Annotations
    11. Summary
  12. CHAPTER 6: Introducing Spring AOP
    1. AOP Concepts
    2. Types of AOP
    3. AOP in Spring
    4. Advisors and Pointcuts in Spring
    5. Understanding Proxies
    6. Summary
  13. CHAPTER 7: More Spring AOP and Annotations
    1. Advanced Use of Pointcuts
    2. Getting Started with Introductions
    3. Framework Services for AOP
    4. AspectJ Integration
    5. AOP in the Sample Application
    6. Summary
  14. CHAPTER 8: Spring JDBC Support
    1. Sample Data Model for Example Code
    2. Exploring the JDBC Infrastructure
    3. Spring JDBC Infrastructure
    4. Using DataSources in DAO Classes
    5. Exception Handling
    6. The JdbcTemplate Class
    7. Spring Classes That Model JDBC Operations
    8. Using the Java Configuration
    9. Spring Data Project: JDBC Extensions
    10. Considerations for Using JDBC
    11. Summary
  15. CHAPTER 9: Using Hibernate in Spring
    1. Create a Hibernate Utility Project in STS
    2. Sample Data Model for Example Code
    3. Configuring Hibernate SessionFactory
    4. ORM Mapping Using Hibernate Annotations
    5. The Hibernate Session Interface
    6. Database Operations with Hibernate
    7. Considerations of Using Hibernate
    8. Summary
  16. CHAPTER 10: Data Access in Spring with JPA2
    1. Introducing JPA 2
    2. Database Operations with JPA
    3. Introducing Spring Data JPA
    4. Keeping Entity Versions by Using Hibernate Envers
    5. Considerations When Using JPA
    6. Using JPA in the Sample Application
    7. Summary
  17. CHAPTER 11: Using MyBatis in Spring
    1. Getting Started with MyBatis in Spring
    2. SQL Mapping in MyBatis
    3. Database Operations with MyBatis
    4. Considerations When Using MyBatis
    5. Using MyBatis in the Sample Application
    6. Summary
  18. CHAPTER 12: Designing and Implementing Spring-Based Applications
    1. Designing to Interfaces
    2. Building a Domain Object Model
    3. The SpringBlog Domain Object Model
    4. Designing and Building the Data Access Layer
    5. Designing the Service Layer
    6. Summary
  19. CHAPTER 13: Transaction Management
    1. Exploring the Spring Transaction Abstraction Layer
    2. Analyzing Transaction Properties
    3. Sample Data Model and Infrastructure for Example Code
    4. Declarative and Programmatic Transactions with Spring
    5. Global Transactions with Spring
    6. Summary
  20. CHAPTER 14: Validation with Type Conversion and Formatting
    1. Creating a Project in STS for Samples
    2. Spring Type Conversion System
    3. Field Formatting in Spring 3
    4. Validation in Spring
    5. Validation with Type Conversion and Formatting in the Sample Application
    6. Summary
  21. CHAPTER 15: Task Scheduling in Spring
    1. Create a Project in STS for the Sample Projects
    2. Task Scheduling in Spring
    3. Asynchronous Task Execution in Spring
    4. Task Scheduling in the Sample Application
    5. Summary
  22. CHAPTER 16: Using Spring Remoting
    1. Creating the Project in STS for the Samples
    2. Implementing the Service Layer for the Samples
    3. Using the Spring HTTP Invoker
    4. Using JMS in Spring
    5. Using RESTful-WS in Spring
    6. Remoting in the Sample Application
    7. Summary
  23. CHAPTER 17: Web Applications with Spring
    1. Create Project in STS for Samples
    2. Implement the Service Layer for Samples
    3. Introducing MVC and Spring MVC
    4. Create the First View in Spring MVC
    5. Spring MVC Project Structure Overview
    6. i18n (Internationalization)
    7. Theming and Templating
    8. Implement the Views for Contact Information
    9. Using jQuery and jQuery UI
    10. File Upload Handling
    11. Securing a Web Application with Spring Security
    12. Support for Servlet 3 Code-Based Configuration
    13. Spring MVC in the Sample Application
    14. Summary
  24. CHAPTER 18: Spring Web Flow and JSF
    1. Project for Sample Backend
    2. Introducing Spring Web Flow
    3. Introducing JSF
    4. The Sample Spring Web Flow Application
    5. Spring Web Flow and JSF Configuration
    6. Implementing the Sample Flow
    7. Implement the Add Contact Flow
    8. Summary
  25. CHAPTER 19: Spring Testing
    1. Project for Sample Web Application
    2. Introducing an Enterprise Testing Framework
    3. Implementing Logic Unit Test
    4. Implementing an Integration Unit Test
    5. Implementing a Frontend Unit Test
    6. Verifying Test Case Code Coverage
    7. Summary
  26. CHAPTER 20: Spring Projects: Batch, Integration, and Roo
    1. Project for Chapter Samples
    2. Introducing Spring Batch
    3. Implementing a Batch Job
    4. Using Spring Batch with Spring Integration
    5. Introducing Spring Roo
    6. Spring Batch and Spring Integration in the Sample Application
    7. Summary
  27. CHAPTER 21: Sample Application in Detail
    1. Setting Up the Sample Application
    2. Application Design
    3. Configuration Details
    4. Implementation Details
    5. Summary
  28. CHAPTER 22: Scripting Support in Spring
    1. Project for Chapter Samples
    2. Scripting Support in Java
    3. Introducing Groovy
    4. Using Groovy with Spring
    5. Summary
  29. CHAPTER 23: Spring Application Monitoring
    1. Project for Chapter Samples
    2. JMX Support in Spring
    3. Monitoring an Application with Spring Insight
    4. Summary
  30. APPENDIX A: SpringSource Tool Suite
    1. Introducing STS
    2. STS Installation
    3. Project Setup and Dependency Management
    4. Using STS
    5. Summary
  31. Index
O'Reilly logo

C H A P T E R  9

Using Hibernate in Spring

In the previous chapter, you saw how to use JDBC in Spring applications. However, even though Spring goes a long way toward simplifying JDBC development, you still have a lot of code to write.

In this chapter, we cover one of the object-relational mapping (ORM) libraries that has wide support in Spring—Hibernate.

If you have experience developing data access applications using EJB entity beans (prior to EJB 3.0), you may remember the painful process. Tedious configuration of mappings, transaction demarcation, and much boilerplate code in each bean to manage its life cycle greatly reduced the productivity when developing enterprise Java applications.

Just like Spring was developed to embrace POJO base ...

The best content for your career. Discover unlimited learning on demand for around $1/day.