Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怎样才能使这项工作?我想计算值为 1 的序列号?谢谢大家,我是初学者。
serial_Number = 1; Query query = (Query) es.em.createQuery("SELECT COUNT(p.serial_Number) FROM Product p where p.product_Id = serials_Number");
以下应该工作
Query query = (Query) es.em.createQuery("SELECT COUNT(p.serial_Number) FROM Product p where p.product_Id =:serial_Number").setParameter("serial_Number", serial_Number);
然后用..
query.getSingleResult();
得到奇异的实体。