Develop the Data Transfer Object

We will define the data transfer object in this lesson.

We'll cover the following

So far we have seen how to manage one-to-one unidirectional and bi-directional relationships. Let’s start by looking at the one-to-one self-referencing association shown in the previous lesson. Here, the Student entity has an identifier and a name field of String type.

The Student can have an optional mentor who is also a Student. Within one instance of Student another instance of Student (the mentor) can be associated. We will start with the script with the mock user interface initially and then the service.

Data transfer object

The data transfer object does not have the identifier of the Student mentor object because the internal design of the one-to-one self-referencing relationship is not exposed to the user interface team. In an instance of a Student object, there could be only one mentor object who is also a Student.

Get hands-on with 1200+ tech skills courses.