A one-to-one relationship
一对一的关系
Driver (1) <-----> (1) Car
举例:一对一的关系意味着司机只能驾驶一辆车,而一辆车只能有一个司机。
================= Driver =================
Fields
name (String)
Generating relationships to other entities
? Do you want to add a relationship to another entity? Yes
? What is the name of the other entity? Car
? What is the name of the relationship? car
? What is the type of the relationship? one-to-one
? Is this entity the owner of the relationship? No
? What is the name of this relationship in the other entity? driver
================= Car =================
Fields
brand (String)
license (String)
Generating relationships to other entities
? Do you want to add a relationship to another entity? Yes
? What is the name of the other entity? Driver
? What is the name of the relationship? driver
? What is the type of the relationship? one-to-one
? Is this entity the owner of the relationship? Yes
? What is the name of this relationship in the other entity? car
? When you display this relationship with Angular, which field from ‘Driver’ do you want to use? This field will be displayed as a String, so it cannot be a Blob name
? Do you want to add any validation rules to this relationship? No
现在在这两个实体之间有一对一的关系!将在Car中选择一个司机,因为Car属于自己的一方。