In which layer should I join 2 entities together?
Posted
by
William
on Stack Overflow
See other posts from Stack Overflow
or by William
Published on 2013-10-22T08:26:24Z
Indexed on
2013/10/22
9:55 UTC
Read the original article
Hit count: 216
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.
© Stack Overflow or respective owner