I have 2 entities: Request and Invoice. (One to many) How can I get result object:
public class TestRequest {
private Long idRequest;
private List<Long> idInvoices;
}
Follow code:
Query query = entityManager.createNativeQuery("Select r.REQUEST_ID idRequest, i.INVOICE_ID idInvoices From WAROWN.T_REQUEST r right join WAROWN.T_INVOICE i on r.REQUESTED_ID = i.CHECK_HISTORY_ID", TestRequest.class);
has exception: There was an error packing the projection and/or aggregate results of the query into result type "class com.mypackage.TestRequest".