Re: Java EE Architecture
art.m...@gmail.com wrote:
I would like to prepare typical Java EE solution (EJB, JSF, JPA) now, and=
I have quite stupid problem related with domain objects. I want to create =
Person class as persistence class, but I don't know in which module I shoud=
put this class: Business Layer (ejb module) or in Integration Layer (jar m=
odule).
If you're using EJBs, your solution might not be typical.
You also left out "WAR" module.
But honestly this question doesn't make sense to me. "EJB module"? "JAR mod=
ule"?
What do these terms even mean?
Person class is more related with logic, so I should put it in ejb module=
, but in this case I will need to create dependency relation from Integrati=
on Layer to Business Layer as Integration Layer need to know what object sh=
ould store in DB (ex. void store(Person object){};).
'Person' is not, in JPA terms, an "object [to] store in [the] DB", but a ty=
ped entity that has a connection
to a data store for persistence. The data view in the data store will not b=
e identical to the object
view in the code that uses the 'Person' type.
From the upper layers' point of view, there is no notion of a database, onl=
y of the entity.
Typically the 'Person' will live in a "JAR" level, if I understand your use=
of the term correctly,
which I probably don't, in that it is an entity without business logic.
Put Person class in Integration Layer will remove this unwanted dependenc=
y, but I feel that Person class is more Business class then Integration cla=
ss.
"Feel"?
What do you think about it?
Use logic, not feelings.
--
Lew