aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
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
Author

Ports and Adapters Architecture in Java EE Applications

Unmesh Chowdhury
Ranch Hand

Joined: Jun 20, 2010
Posts: 45
Hi,

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?

Thanks,
Unmesh

Related Links:
http://alistair.cockburn.us/Hexagonal+architecture
http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html

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