In which layer should I join 2 entities together?
- by William
I use Spring MVC and a regular JDBC.
I've just learned that I should separate business process into layers which are presentation layer, controller layer, service layer, and repository/DAO layer. Now suppose that I have an Entity called Person that can have multiple Jobs. Job itself is another entity which have its own properties. From what I gathered, the repository layer only manages one entity. Now I have one entity that contains another entity. Where do I "join" them? The service layer?
Suppose I want to get a person whose job isn't known yet (lazy loading). But the system might ask what the job of that particular person is later on. What is the role of each layer in this case?
Please let me know if I need to add any detail into this question.