I am using JPA and and Jackson is used for generating JSON
Emp.java
@Entity
@NamedQuery(name = \"Emp.findAll\",
query = \"select o.empNo, o.
NAmed Query select o.empNo, o.empName from Emp o
will return List
where as select o from Emp o
will return List
, so accordingly json
will be produced.
You can change the query as below
select new Emp(o.empNo, o.empName) from Emp o
and have a constructor in your class accordingly.
or try using
select new Map(o.empNo as empNo , o.empName as empName) from Emp o