官术网_书友最值得收藏!

Chapter 2. Advanced Mapping

In this chapter, we will explore mapping concepts. This is at the core of the Object-Relational Mapping challenge to correctly map Java objects and classes to their persistence representation. As discussed in the previous chapter, the object-oriented world has a lot in common with the relational world, attributes, types, and so on. The ORM solutions, such as Hibernate, were created to address their notable differences, inheritance, composition, object reference and identification, and much more. After reading this chapter, you will be able to correctly map database identification to a class attribute using primitive data types or a more complex Java class. You will also see how to create associations between objects and annotate them correctly so that Hibernate has enough information about the relationships between table data. Furthermore, you will be able to instruct Hibernate to perform cascaded operations and map classes as part of an inheritance model. Finally, you will see how to work with enumerated types and create your own custom type.

In this chapter, we will cover the following topics:

  • Mapping concepts:
    • Instance and row
    • Annotation verses XML
    • Owning entity
    • Value mapping
    • JPA ID generation
    • Hibernate ID generation
    • Composite ID
  • Association cardinality:
    • One-to-one association
    • One-to-many association
    • Many-to-many association
    • Self-referencing tables
  • Cascade operations
  • Inheritance:
    • Single table strategy
    • Table per class strategy
    • Joined strategy
  • Custom mapped data type
主站蜘蛛池模板: 西华县| 克什克腾旗| 邯郸市| 社旗县| 万安县| 嘉黎县| 太康县| 垦利县| 梨树县| 靖州| 色达县| 安福县| 陇川县| 辽阳市| 陆丰市| 和林格尔县| 射阳县| 民勤县| 抚远县| 静安区| 黔南| 额济纳旗| 应城市| 静海县| 乐业县| 林甸县| 香港| 中西区| 阳新县| 玉溪市| 麦盖提县| 长丰县| 全南县| 潼关县| 通江县| 庆阳市| 青神县| 四会市| 长沙县| 收藏| 安顺市|