Responsibilities of a Persistence Adapter
Explore the responsibilities of a persistence adapter, including receiving input through a port, mapping data formats for the database, and returning results in application core format. Understand how this role supports isolation and flexibility in Hexagonal Architecture.
Persistence adapter
This is what a persistence adapter usually does:
- Takes input
- Maps input into database format
- Sends input to the database
- Maps database output into application format
- Returns output
Take input
The persistence adapter takes input through a port interface. The input model may be a domain entity or an object dedicated to a specific database operation, as specified by the interface.