New Spring-Data Demo on GitHub

I just pushed a new repo to GitHub called Spring-Data which demonstrates using Hibernate and Spring Data. The app uses a MySQL backend with Spring Annotation Context (no XML files) and a Gradle build configuration.

The app is based on Chapter #7 of Pro Spring, Fourth Edition from Apress, “Using Hibernate.” (An excellent book, btw.) Here is the book’s listing on Apress. For fellow Safari users, here is the online version of it on Safari for additional details.

A successful execution would look like this.

Image of Successful Output

Implemented in Spring-Data

v0.0.1

  • Changed XML Spring Configuration to Annotations
  • Changed datasource from embedded H2 to MySql
  • Lazy Fetching
  • Named Queries
  • Logging Configuration Added
  • Gradle Build Configuration
  • Inserting data with Hibernate
  • Note: v0.0.1 was created with Spring Boot v1.1.4. Using v1.2.x generates a compile error regarding JPA Entity handling.

I plan on following up v0.0.1 with a v0.0.2 using the latest Spring Boot release v1.2.3, resolving the JPA Entity handling issues I mentioned.

Installing Spring-Data is a simple matter of running the setup.sql script in the /install directory to populate the database and adding your MySQL connection properties in AppConfig Class.