Skip to main content
Hibernate Criteria API for JPA-2.0
To access the above table data,we can use the Criteria Builder API,
public List getStockList(Integer stockId){
CriteriaBuilder cb=em.getCriteriaBuilder();
CriteriaQuery c=cb.createQuery(Stock.class);
Root stock=c.from(Stock.class);
CriteriaQuery stoo=c.select(stock).where(criteriaBuilder.equal(stock.get("stockId"),stockId)); TypedQuery query=em.createQuery(stoo);
return query.getResultList();
}
Comments