我正在使用jpa查询,只有3列,但它没有得到列名,即使我命名了查询列,那么这就是我的Json响应的样子
[["123","name1","age15"],["124","name2","age12"],["125","name3","age14"]]
这就是我做的
<table id="resultTable" border="1"></table>
.
.
success : function(data) {
var html = '';
var index = [];
for (var x in data) {
html += "<tr>";
html += "<td>" + data[index.push(x)] + "</td>"
+"<td>"+ data[index.push(x)] + "</td>"
+"<td>"+ data[index.push(x)] + "</td>"
html += "</tr>";
}
$('#resultTable').html(html);
And this is the result which i got
However, This is what i expect for
同样,我只查询3列的原因是我一直面对
JsonMappingException:懒得初始化角色的集合:
,但我真正想要的只是3列,而不是整个实体&#39;柱。好吧,我的jpql查询看起来像这样
("SELECT s.Id,s.name,s.age FROM Student s").getResultList();