Java Reference
In-Depth Information
Heart of Software , by Eric Evans [Addison-Wesley Professional, 2003]). DDD emphas-
izes that domain objects should contain business logic and shouldn't just be dumb replicas
of database records. Domain objects can be implemented as entities in JPA. With DDD,
a Catalog object in a trading application might, in addition to having all the data of an
entry in the catalog table in the database, know not to return catalog entries that aren't in
stock. Being POJOs, JPA entities support OO features, such as inheritance and polymorph-
ism. It's easy to implement a persistence object model with the JPA and to add business
logic to your entities. Now, DDD still utilizes a service layer or application layer (see Pat-
terns of Enterprise Application Architecture , by Martin Fowler [Addison-Wesley Profes-
sional, 2002]). The application layer is similar to the business logic layer of the tradition-
al four-tier architecture but much thinner. EJB works well as the service-layer component
model. Whether you use the traditional four-tier architecture or a layered architecture with
DDD, you can use entities to model domain objects, including modeling state and behavi-
or. We'll discuss domain modeling with JPA entities in chapter 7 .
Search WWH ::

Custom Search