Reputation: 382
When I query Hibernate with a:
"select a from Account a", JAXRS gives me column names in my JSON, but when I execute this query:
"select a.firstName, a.lastName from Account a" the JSON simply contains the data without the column names.
For instance:
{ firstName: "Simon" }
becomes:
{ "Simon" }
Upvotes: 0
Views: 263
Reputation: 691755
select a from Account a
is a JPQL query that returns a List<Account>
. This list is thus serialized to JSON as an array of objects.
On the other hand,
select a.firstName, a.lastName from Account a
is a JPQL query that returns a List<Object[]>
. This list is thus serialized to JSON as an array of arrays.
And finally,
select a.firstName from Account a
is a JPQL query that returns a List<String>
. This list is thus serialized to JSON as an array of strings.
Upvotes: 1