How do I achieve two things at the same time writing Java Spring Application:
- Clean Architecture
- JPA goodies (@Transactional, Optimistic Locking, dirty checking, etc.)
I like the idea of database/ORM framework being an unimportant detail that can be easily replaced, but I'm not sure how to effectively implement it.
Let's say potentially I want to replace JPA/Hibernate with jOOQ or Spring Data JDBC.
But at the same time, I want to have support for transactions, dirty checking, etc.
How should I process use case in an application/domain layer so it can have merits of two worlds?
I don't have to mention that with clean architecture I have to convert domain type to entity type every time I speak with database.