• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ports and Adapters Architecture in Java EE Applications

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic