1

我想用这种方法从 2 个 sql 表中选择一个结果:

@Override
    public List<Object> getAll() {

        Query query = entityManager
                .createQuery("select a.idAccount, c.firstName, c.lastName, a.dateOfCreation, a.bonusPoint from account a ,customer c where c.identity=a.id_Customer and a.bonusPoint>=5000 and TO_DAYS(NOW()) - TO_DAYS(a.dateOfCreation) >=60");
        return query.getResultList();
    }

我想在数据表中显示这个查询,所以我在 ManagedBean 中使用数据模型:

public DataModel getDataModel() {
        dataModel.setWrappedData(gIftManagementRemote.getAll());
        return dataModel;
    }

在 jsf 页面中,我使用了一个数据表,但我不知道应该在“var”中输入什么:

<rich:dataTable rows="15" id="table" value="#{assignGiftManagement.dataModel}"
            **var**="?????">

所以当我运行这个页面时,我有这个例外:

javax.servlet.ServletException: java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: id_Customer of: tn.esprit.bankSprint2.persistence.Account [select a.idAccount, c.firstName, c.lastName, a.dateOfCreation, a.bonusPoint from tn.esprit.bankSprint2.persistence.Account a ,tn.esprit.bankSprint2.persistence.Customer c where c.identity=a.id_Customer and a.bonusPoint>=5000 and TO_DAYS(NOW()) - TO_DAYS(a.dateOfCreation) >=60]
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)

我应该做什么?!

4

0 回答 0