I have a JAX-RS method that returns me a List with DO's. Unfortunetly when I go to the path which is mapped by the method i get only an empty json list like:
[{}, {}, {}]
My resource method looks like this:
@GET
@Produces("application/json")
public List<ModelDO> getModels() {
List<ModelDo> models = modelRepo.findAllModelsWithName("Name");
return models;
}
I'm 100% sure the objects exists and the list isn't empty, because I have checked it in the debugger.
The ModelDO class is a simple POJO:
public class ModelDO {
private int id;
private String name;
//public getters
}
What should I do to get an non empty json response? PS. When I'm returning a single object I get the same problem -> {}
EDIT:
modelRepo:
public List<ModelDO> findAllModelsWithName(String name){
return new JPAQueryFactory(entityManager).selectFrom(modelEntity)
.where(modelEntity.name.eq(name))
.fetch();
}
ModelRepo.class is @Injected into my Resoure class