Reputation: 746
Situation : (Using springs) I have a repository with two methods defined with custom queries
@Query("-----")
public Object getA();
@Query("-----")
public List<Object> getB();
For some reason I don't want to write a join query to retrieve the data,
In the controller I define an end point and in that I can call those methods for which I am able to retrieve the data,
But I would want something like this,
All objects of B should be inside the A Object.
A(Object)
a1:
a2:
a3:
B[3] :
b1:
b2:
b3
How can I do this?
Upvotes: 0
Views: 60
Reputation: 807
Apart from writing a Service that wraps the Repository: Since it seems you are already using Spring Data, you could just write a custom query method, that combines both queries (http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.single-repository-behaviour).
Upvotes: 1