I am working on a pretty complex project that involves multiple services in the backend. Each service is its own spring project. I am using an H2 instance for the project.
For the sake of example, let's say I have the same entity class across all services, lets say EntityA
. Is it possible to have multiple JPA repositories across all the projects for that EntityA
?
In Service1:
public interface EntityARepository extends JpaRepository<EntityA, ID>
In Service2:
public interface EntityARepository extends JpaRepository<EntityA, ID>
etc...
Having something like that in each of the services, which are each their own spring project? I need to be able to access EntityA
across all of the services but would like to only use one H2 instance.
Is this possible? I know that it is not possible to have multiple repositories for the same entity within one spring project. But how about across multiple?