The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Ports and Adapters Architecture in Java EE Applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Ports and Adapters Architecture in Java EE Applications" Watch "Ports and Adapters Architecture in Java EE Applications" New topic

Ports and Adapters Architecture in Java EE Applications

Unmesh Chowdhury
Ranch Hand

Joined: Jun 20, 2010
Posts: 45

I want to implement Java EE 7 applications based on the hexagonal architecture (a.k.a. ports and adapters) or onion architecture or clean architecture. Now, the problem is that where I should place my entities. If I place my entities in the application circle then my application will depend on a particular persistence infrastructure, moreover, any kinds of technical infrastructures should not be exposed in the application layer. Thus, the entities should be placed into the persistence adapters, but if so, then when I retrieve entities from the persistence adapter then the dependency rule will be broken, since the rule says that source code dependency can only point inwards, i.e. nothing in an inner circle can know anything at all about something in an outer circle. An alternative could be that I can use DTOs in the application layer and save and retrieve the data through the ports (APIs) that will be defined in the application hexagonal and implemented by the persistence adapters. In this case the duplication of code would be increased definitely, which is a bad design indeed. What should I do in this context?


Related Links:

M.Sc. in CS, OCPJP6 93%
I agree. Here's the link: http://aspose.com/file-tools
subject: Ports and Adapters Architecture in Java EE Applications
Similar Threads
What it takes to be an architect?
Terminology Clarification
Suggestion Required on packaging POJOs/DTOs with Web Service projects
FREE: SCEA 5 Beta Certification Exam (Three Parts)
SCEA 5 Part 2 Objectives? (previous link removed)