Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Data Transfer Object (DTO) using Domain layer?  RSS feed

 
Joao Longo
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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!
 
Joemon Anthony
Greenhorn
Posts: 26
Java Oracle
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!