• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Data Transfer Object (DTO) using Domain layer?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi people!

I have a system using EJB + ZK framework (for presentation layer). The layers of the system are:

* presentation
* application - connects presentation with services
* services - EJBs
* domain - JPA entities

I would like to separate the data between services and application in order to do not have attached entities in application layer. I've read about Data Transfer Object design pattern and some strategies. But I also realize and read that if my entities are always detached in application/presentation layers I'll solve my problem. How can I ensure that? What do you think about this approach?

Thanks a lot!
 
Greenhorn
Posts: 26
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joao,

I would like to separate the data between services and application in order to do not have attached entities in application layer.



Its a good approach and you should do like this only. By doing this there will be loose coupling between different layers and design should be like that only.

Entities should never be accessible in Presentation layer(poor design). Your service layer(EJB) should call the DTO layer(JPA) and in the DTO layer you should write all the persistence logic. And in DTO layer(JPA) only the entities should be accessible.
reply
    Bookmark Topic Watch Topic
  • New Topic