I wanted to make several applications / modules that communicate through webservices Rest, I like to use the dao pattern and I was looking for if jpa or hibernate or spring data (in general an ORM), they allowed to do this kind of thing, that is, consult a jpa repository but instead of consulting a database, consult a webservice. I know that it is only to create the queries to the service in rest, but I remain with the professional doubt of if it is possible to use an ORM or some other implementation that allows to consult one on a rest resource.
It suddenly occurred to me to expose a service with ODATA, graphql and call it a repository but I did not find something to read from a repository of an orm or something similar.
Is there a way to do this in this way? Is there another way to implement what I want? Is it wrong to want to do this from the point of good practice? Can the modules be communicated in another way?