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

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
主站蜘蛛池模板: 昭通市| 彩票| 泗洪县| 页游| 桓仁| 嘉义市| 邢台市| 永济市| 彭泽县| 济南市| 修武县| 兴安县| 白河县| 桑植县| 故城县| 徐闻县| 扎兰屯市| 芦溪县| 健康| 芮城县| 义马市| 理塘县| 和静县| 临江市| 台湾省| 德清县| 张家界市| 大姚县| 玛多县| 温泉县| 右玉县| 长岭县| 习水县| 旬邑县| 青铜峡市| 西贡区| 刚察县| 鄯善县| 荆州市| 淮安市| 和龙市|