其他分享
首页 > 其他分享> > JPA entityManager.createQuery IN

JPA entityManager.createQuery IN

作者:互联网

 

 QuotationV quotationV = entityManager.createQuery("select e from QuotationV e where e.consignmentId = :consignmentId and e.status not in (?1,?2)", QuotationV.class)
                        .setParameter(1, IOQStates.INVALIDED.name())
                        .setParameter(2, IOQStates.END.name())
                        .setParameter("consignmentId", consignmentEntity.getId()).getSingleResult();

 

 

 public List<BaseRuleDto> findByIds(List<Long> ids) {
        List<BaseRules> list = entityManager.createQuery("select e from BaseRules e where e.id in :ids ")
                .setParameter("ids", ids).getResultList();
}

 

@Override
    public List<Receipt> findByIds(List<Long> ids) {

        List<Receipt> details = entityManager.createQuery("select e from Receipt e where e.id in (:ids) ")
                .setParameter("ids", ids)
                .getResultList();
        return details;

    }

 

标签:entityManager,JPA,List,ids,setParameter,createQuery,select
来源: https://blog.csdn.net/liuming690452074/article/details/112278423