3 Domain models and metadata


This chapter covers

  • Discovering the CaveatEmptor example application
  • Implementing the domain model
  • Examining object/relational mapping metadata options

The “Hello World” example in the previous chapter introduced you to Hibernate and Spring Data; certainly, it isn’t useful for understanding the requirements of real-world applications with complex data models. For the rest of the book, we use a much more sophisticated example application—CaveatEmptor, an online auction system—to demonstrate Jakarta Persistence, Hibernate, and later Spring Data. (Caveat emptor means “Let the buyer beware”.)

3.1 The example CaveatEmptor application

3.1.1 A layered architecture

3.1.2 Analyzing the business domain

3.1.3 The CaveatEmptor domain model

3.2 Implementing the domain model

3.2.1 Addressing leakage of concerns

3.2.2 Transparent and automated persistence

3.2.3 Writing persistence-capable classes

3.2.4 Implementing POJO associations

3.3 Domain model metadata

3.3.1 Annotation-based metadata

3.3.2 Applying constraints to Java objects

3.3.3 Externalizing metadata with XML files

3.3.4 Accessing metadata at runtime

3.4 Summary