As I understand it, one of the key rules of Hexagonal Architecture is how the Domain Layer is isolated from everything except the Application Layer which works with it (the Domain Layer has no dependencies at all as it sits in the core):
My question is then, does the Domain Layer ever do any work or have any knowledge of data persistence whatsoever? Suppose we have some business logic which depends on data being retrieved and then persisted, should it always be the Application Layer which is orchestrating this?
Load everything required for the business logic to run -> Tell the Domain Layer to run all the business logic -> Extract the results of the business logic and tell the Infrastructure Layer to persist them ->
In this sense, wouldn't the Application Layer always need to keep track of any result the Domain Layer has calculated, and therefore would always implement some kind of UnitOfWork pattern to track these results?
Would the Domain Layer ever work with a repository, or an interface of a repository whatsoever? There are some sources which seem to suggest this is fine, which completely contradicts the diagram from my perspective.