6 Mapping value types

This chapter covers

  • Mapping basic properties
  • Mapping embeddable components
  • Controlling mapping between Java and SQL types

After spending the previous chapter almost exclusively on entities and their class- and identity-mapping options, we’ll now focus on value types in their various forms. Value types are frequently encountered in classes under development. We’ll separate value types into two categories: basic value-typed classes that come with the JDK, such as String, Date, primitives, and their wrappers; and developer-defined value-type classes, such as Address and MonetaryAmount in CaveatEmptor.

In this chapter, we’ll first map persistent properties with JDK types and discuss the basic mapping annotations. We’ll look ...

Get Java Persistence with Spring Data and Hibernate now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.