Chapter 3. Database persistence with entities

 

This chapter covers

  • Your business objects and persistence
  • Working with entities
  • What about validation?
  • Searching with finders

In the last chapter, we discussed Spring Roo from a developer’s perspective. We discussed the various component types, and how the Roo shell creates and maintains objects in your projects, hiding tedious, repetitive code behind AspectJdriven.aj files.

In this chapter, you’ll learn how to store and load data from relational databases. You’ll start by defining object-relational mapping (ORM) APIs and the standard Java Persistence API, and then learn how to configure persistence in a project using the Roo shell. Next, you’ll define Roo entities, which are an enhanced version of the standard JPA Entity class. You’ll create entity components in the shell, and we’ll show you how to load, persist, and remove them, using Roo’s JUnit-based integration test framework.

Next, you’ll use the Bean Validation Framework to configure automatic data validation in your entities. We’ll discuss both built-in and custom validations, and how to provide validation messages. We’ll discuss finders—methods that allow for searching for properties within a Roo entity. We’ll wrap up by discussing JPA Repositories.

3.1. Your business objects and persistence

 
 
 

3.2. Working with entities

 

3.3. Validating Courses with Bean Validation

 
 

3.4. Searching with finders

 
 

3.5. Leaving Active Record—JPA repositories

 
 

3.6. Code samples

 
 

3.7. Summary

 
 
 

3.8. Resources

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage