I’m trying to return a DTO via rest queries, but the postman from the api is returning me an empty array.
<query name="applicants" entity="jb_ApplicantDTO" fetchPlan="key-value">
<jpql>
<![CDATA[
select new com.company.service.restservices.applicant.ApplicantDTO(a.id, a.firstName)
from jb_Applicant a
]]>
</jpql>
</query>
I have full access role.
I tried it for jb_Applicant and it returns me a list.
I’ve tried everything but it’s not working at all and I’m not getting any errors. 200 code and an empty array
As i said, in first approximation seens like this caused by Jmix DataManager, but i need more time to R&D, probably will come back with detailed answer.
Possible solutions:
Also, you can check Projection in JPA:
public interface UserProjection {
String getUsername();
String getEmail();
}
@Query("SELECT u.username AS username, u.email AS email FROM User u")
List<UserProjection> findAllUserProjections();