You must associate the Teacher and Subject entities in your domain model.
When you edit Teacher select the subjects they teach or when you edit the Subject, select the Teacher who teaches it.
Then based on the association, you could show the teacher name in the next page.
If for some reason, you dont want to associate, but still show the teacher name, then you must go with non-Persistable entity and store the teacher name in an attribute.
Use the NPE as page entity and design the page with other entities you may need.
A fast way, most of the time, is to go to your domain model, set the association, then right-click and ‘Generate overview pages’.
In your domain model, what association do you have between Subject and Teacher.
If each subject has only one teacher, it is easy:
- add a reference selector on the Subject-page in the dataview
- assign attribute Subject_Teacher/Teacher/Name to it
If they are related *-*: each subjects gets tought by several teachers and each teacher teaches several subjects, then instead of a reference-selector, use a reference set-selector.