- 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.
- Deploying Node.js
- Microsoft Exchange Server PowerShell Cookbook(Third Edition)
- Docker進(jìn)階與實(shí)戰(zhàn)
- iOS 9 Game Development Essentials
- Java程序員面試算法寶典
- Visual FoxPro程序設(shè)計(jì)
- Nginx Lua開(kāi)發(fā)實(shí)戰(zhàn)
- MongoDB,Express,Angular,and Node.js Fundamentals
- Unity 2017 Mobile Game Development
- Mastering Unity 2D Game Development(Second Edition)
- Mastering C++ Multithreading
- Python:Deeper Insights into Machine Learning
- iOS開(kāi)發(fā)項(xiàng)目化入門(mén)教程
- XML程序設(shè)計(jì)(第二版)
- 零基礎(chǔ)PHP從入門(mén)到精通