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

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
主站蜘蛛池模板: 黔西| 巫山县| 汨罗市| 铅山县| 湖北省| 永平县| 图们市| 定边县| 铁岭市| 峨边| 土默特左旗| 平武县| 泾源县| 东台市| 长泰县| 阿瓦提县| 禹城市| 漳平市| 罗城| 博湖县| 钦州市| 张家港市| 宁河县| 通江县| 改则县| 九江县| 融水| 炎陵县| 五原县| 乐陵市| 瓦房店市| 横山县| 锦州市| 泾川县| 珠海市| 棋牌| 桐城市| 洛阳市| 阿克苏市| 庆安县| 商河县|