我最初通过以下查询获得List<Employee>
:
Query query = session.createQuery("select table1 from Table as table1");
this.employees = (List<Employee>) query.list();
这在下面的数据表中成功呈现:
<p:dataTable var="employee" value="#{bean.employees}">
<p:column id="name" headerText="Name">
<h:outputText value="#{employee.name}" />
</p:column>
<p:column id="id" headerText="ID" >
<h:outputText value="#{employee.id}" />
</p:column>
</p:dataTable>
但是,当我尝试从以下 2 个表中检索它时:
Query query = session.createQuery("select a.name, b.id from Table1 as a, Table2 as b");
this.employees = (List<Employee>) query.list();
它抛出以下异常:
java.lang.NumberFormatException: For input string: "name"
at java.lang.NumberFormatException.forInputString(Unknown source)
at java.lang.Integer.parseInt(Unknown source)
at java.lang.Integer.parseInt(Unknown source)
at javax.el.ArrayELResolver.toInteger(ArrayELResolver.java:166)
at javax.el.ArrayELResolver.getValue(ArrayELResolver.java:46)
...
这是如何引起的,我该如何解决?