Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JPA填充列表中的JSF调用方法_Jsf_Jpa_Methods - Fatal编程技术网

JPA填充列表中的JSF调用方法

JPA填充列表中的JSF调用方法,jsf,jpa,methods,Jsf,Jpa,Methods,我有一个数据库表,其中包含一些oneToMany关系。 这是实体的片段: @OneToMany(mappedBy="auction") private List<Biding> bidings; 问题是“找不到方法”。似乎出于某种原因,它甚至还没有使用AuctionBean类。这可能是一个问题,为什么它看不到方法。我做得对,问题到底在哪里?你能帮忙吗?我有两个建议: 1.使用singleAuction.higherBid,而不是singleAuction.getHigherBid(

我有一个数据库表,其中包含一些oneToMany关系。 这是实体的片段:

@OneToMany(mappedBy="auction")
private List<Biding> bidings;

问题是“找不到方法”。似乎出于某种原因,它甚至还没有使用AuctionBean类。这可能是一个问题,为什么它看不到方法。我做得对,问题到底在哪里?你能帮忙吗?

我有两个建议:
1.使用singleAuction.higherBid,而不是singleAuction.getHigherBid()
2.指定查询的目标类。下面是一个例子:

return entityManager.createQuery("SELECT e FROM Auction e", AuctionBean.class)
    .getResultList();

请复制粘贴问题中未修改的确切异常和完整堆栈跟踪,而不是将其过度概括为“问题”。异常和完整堆栈跟踪非常重要,因为它们本身就是完整的答案!你不能阅读/解释它们并不意味着你可以忽略它,就好像它是装饰一样。
    @ManagedBean
    public class AuctionListBean 
    {
        @PersistenceContext()
        EntityManager entityManager;

        public List<AuctionBean> getAuctionList() {
            Query query = entityManager.createQuery("SELECT e FROM Auction e");
            @SuppressWarnings("unchecked")
            List<AuctionBean> resultList = (List<AuctionBean>) query.getResultList();
            return resultList;
        }
    }
public double getHigherBid()
    {
        double higherBid = 0;
        for(Biding a : bidings)
        {
            if(a.getCurrentPrice() > higherBid) 
                higherBid = a.getCurrentPrice();
        }
        return higherBid;
    } 
return entityManager.createQuery("SELECT e FROM Auction e", AuctionBean.class)
    .getResultList();