`

Owning Side and Inverse Side of JPA entity relationships

    博客分类:
  • JEE
阅读更多

Entity relationships may be bidirectional or unidirectional. A bidirectional relationship has both an owning

side and an inverse side. A unidirectional relationship has only an owning side. The owning side of a

relationship determines the updates to the relationship in the database.

 

The following rules apply to bidirectional relationships:

 

  • The inverse side of a bidirectional relationship must refer to its owning side by use of the mappedBy element of the OneToOne, OneToMany, or ManyToMany annotation. The mappedBy element designates the property or field in the entity that is the owner of the relationship.
  • The many side of one-to-many / many-to-one bidirectional relationships must be the owning side, hence the mappedBy element cannot be specified on the ManyToOne annotation.
  • For one-to-one bidirectional relationships, the owning side corresponds to the side that contains the corresponding foreign key.
  • For many-to-many bidirectional relationships either side may be the owning side.

The cascade=REMOVE should only be applied to associations that are specified as

OneToOne or OneToMany. Applications that apply cascade=REMOVE to other associations are not portable.

 

 

 

分享到:
评论

相关推荐

    jpa--12.双向一一

    在这个例子中,`@OneToOne`注解用于定义一对一关系,`mappedBy`属性在`User`实体中指定`Account`为关系的“owning side”,表示`Account`实体中的`user`字段控制着关系的维护。而`@JoinColumn`在`Account`实体中指定...

    inverse=true的总结

    这就是所谓的“主控端”(owning side)和“被控端”(inverse side)。 1. **什么是“inverse=true”**: 当我们将一个关联关系的`inverse`属性设置为`true`时,表示该关联的维护责任由关联的另一方负责。这意味...

    大学英语作文十例.docx

    Trust is the foundation of interpersonal relationships and societal cooperation. The current诚信危机 highlights the need for individuals to act responsibly and transparently. Building trust requires ...

    「安全资讯」hta-t07_modern-exploitation-owning-all-of-the-things -

    「安全资讯」hta-t07_modern-exploitation-owning-all-of-the-things - 数据安全 漏洞分析 漏洞预警 WEB应用防火墙 工控安全 安全管理

    Learning Python

    guided experimentation., First off, Learning Python shows the relationships among Python scripts and their interpreter (in a mostly platform-neutral way). Then, the authors address the mechanics of ...

    Cohen-Game-Of-Chromes-Owning-The-Web-With-Zombie-Chrome-Extensio

    Cohen-Game-Of-Chromes-Owning-The-Web-With-Zombie-Chrome-Extensions-wp

    Cohen-Game-Of-Chromes-Owning-The-Web-With-Zombie-Chrome-Extens

    标题和描述中提到的“Cohen-Game-Of-Chromes-Owning-The-Web-With-Zombie-Chrome-Extens”以及“Owning the Web with Zombie Chrome Extensions”涉及了一系列关于恶意Chrome浏览器扩展(称为“僵尸扩展”)的研究,...

    09新东方在线考研英语强化班阅读讲义

    Furthermore, students must be able to analyze and interpret economic data, understand macroeconomic indicators, and evaluate the impact of government policies on the economy. Familiarity with ...

    BEYOND WAVELETS

    Investigators already familiar with wavelet methods from areas such as engineering, statistics, and mathematics will benefit by owning this volume. Hardcover: 320 pages Publisher: Academic Press; 1...

    英语四级作文范文.docx

    As students, being mindful of one's spending habits, understanding the importance of saving, and learning to manage personal finances will not only lead to a more fulfilling college experience but ...

    Hacking Vim

    Kim Schulz has an M.Sc. in Software Engineering from ... This has lead to him now owning the web-hosting company Devteam Denmark that specializes in hosting and development of Fundanemt-based websites.

    数位板压力测试

    The availability of drivers that support the features of the specification will simplify the process of developing Windows ...and enhance the acceptance of ad¬vanced pointing de¬vices among users....

    procexp.zip

    The top window always shows a list of the currently active processes, including the names of their owning accounts, whereas the information displayed in the bottom window depends on the mode that ...

    Process Explorer

    The top always shows a list of the currently active processes, including the names of their owning accounts, whereas the information displayed in the bottom window, which you can close, depends on ...

    Hibernate关联关系疑问

    7. **反向关联(Inverse)**:在双向关联中,一方称为拥有端(owning side),另一方称为无主端(inverse side)。无主端的关联不会影响数据库操作,所有操作都由拥有端控制。通过@JoinColumn的nullable属性和...

    信息安全_数据安全_Owning Your Professional Narrative.pdf

    Camille Stewart在其演讲"Owning Your Professional Narrative"中强调了如何有效地管理和表达自己的专业故事,这对于网络安全专家尤其重要,因为这不仅关乎个人成长,也影响着安全工作的执行和效果。 首先,确定3-5...

Global site tag (gtag.js) - Google Analytics