You create a unidirectional many-to-one relationship between
The following example defines an Employee(many side) model and a Department(one side) model:
Let's add a many-to-one relationship with a foreign key to Employee.
To define it, use ModelRef<ModelType>.
The following error will be shown for departmentRef field:
Use quick fix(hold down CTRL+1) and select "Create getter and setter for 'departmentRef'".
The following error will be shown for setDepartmentRef method:
As the message says, define addressRef field and delete setDepartmentRef method.
Now let's create an employee and a department.
You can get an employee and a department. The relationship is loaded lazily.
Continue to Bidirectional One-to-Many Relationships.