Spring中给sql的变量赋值

String hql = "from CSTInventory inventory where inventory.productNumber = :productNumber and inventory.supplier.coden = :supplierCoden";
   return (CSTInventory)this.createQuery(hql).setParameter("productNumber", productNumber).
      setParameter("supplierCoden", supplierCoden).uniqueResult();

给in赋值

String countHQL = "select count(compound.id) from CSTCompound  compound where 1=1 ";
  
  StringBuilder builder = new StringBuilder();
  builder.append(countHQL);
  builder.append(" and compound.structure.id in (:ids)");
  query = query.setParameterList("ids", structureIds);
   

猜你喜欢

转载自jhyimu2005.iteye.com/blog/1441298