- Java EE 8 Application Development
- David R. Heffelfinger
- 156字
- 2021-07-02 22:05:05
Entity relationships
In the previous section, we saw how to retrieve, insert, update, and delete single entities from the database. Entities are rarely isolated; in the vast majority of cases they are related to other entities.
Entities can have one-to-one, one-to-many, many-to-one, and many-to-many relationships.
In the CustomerDB database, for example, there is a one-to-one relationship between the LOGIN_INFO and the CUSTOMERS tables. This means that each customer has exactly one corresponding row in the login info table. There is also a one-to-many relationship between the CUSTOMERS table and the ORDERS table. This is because a customer can place many orders, but each order belongs only to a single customer. Additionally, there is a many-to-many relationships between the ORDERS table and the ITEMS table. This is because an order can contain many items and an item can be on many orders.
In the next few sections, we will discuss how to establish relationships between JPA entities.
- Mobile Web Performance Optimization
- Java系統分析與架構設計
- Game Programming Using Qt Beginner's Guide
- Vue.js 3.x從入門到精通(視頻教學版)
- STM32F0實戰:基于HAL庫開發
- 微信小程序入門指南
- 精通MATLAB(第3版)
- 微信小程序開發實戰:設計·運營·變現(圖解案例版)
- SQL Server 2016 從入門到實戰(視頻教學版)
- Python大規模機器學習
- 超簡單:用Python讓Excel飛起來(實戰150例)
- Isomorphic Go
- Design Patterns and Best Practices in Java
- 熱處理常見缺陷分析與解決方案
- 軟件測試項目實戰之功能測試篇