You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found the domain model is marked with JPA annotations, but the repository is not directly implemented by JPA.
So I think the reason the repository is a plain java interface is that we can choose the repository technique by the application, we say the application provides the actually runtime and the underlaying implementation, it can be see as an runtime.
But if the repository is not implemented inner the domain layer, the domain entity should not coupled with any concrete technique
If so, wen can freely change the persistence layer from RDBMS likes mysql to NoSQL like mongodb without affecting the core domain. Even we can move the core domain layer into an single jar.
The text was updated successfully, but these errors were encountered:
Indeed, me and @mackapappa have discussed this for quite some time. The only reason the JPA annotations have been placed in the domain objects is because we wanted to move away from using XML bindings for Hibernate, and this was the recommended way to migrate. However, just like you say, this causes the domain objects to be coupled to the repository implementation, which is not ideal.
We do actually have two branches that demonstrate two alternative ways of implementing the repository layer without coupling the domain objects and repository implementation:
I found the domain model is marked with JPA annotations, but the repository is not directly implemented by JPA.
So I think the reason the repository is a plain java interface is that we can choose the repository technique by the application, we say the application provides the actually runtime and the underlaying implementation, it can be see as an runtime.
But if the repository is not implemented inner the domain layer, the domain entity should not coupled with any concrete technique
If so, wen can freely change the persistence layer from RDBMS likes mysql to NoSQL like mongodb without affecting the core domain. Even we can move the core domain layer into an single jar.
The text was updated successfully, but these errors were encountered: