jax rs - Not null object but empty json -
i have jax-rs method returns me list do's. unfortunetly when go path mapped method empty json list like:
[{}, {}, {}]
my resource method looks this:
@get @produces("application/json") public list<modeldo> getmodels() { list<modeldo> models = modelrepo.findallmodelswithname("name"); return models; }
i'm 100% sure objects exists , list isn't empty, because have checked in debugger.
the modeldo class simple pojo:
public class modeldo { private int id; private string name; //public getters }
what should non empty json response? ps. when i'm returning single object same problem -> {}
edit:
modelrepo:
public list<modeldo> findallmodelswithname(string name){ return new jpaqueryfactory(entitymanager).selectfrom(modelentity) .where(modelentity.name.eq(name)) .fetch(); }
modelrepo.class @injected resoure class
the reason model object did not have field setters, getters.
Comments
Post a Comment