`
jhyimu2005
  • 浏览: 181646 次
  • 性别: Icon_minigender_2
  • 来自: 苏州
社区版块
存档分类
最新评论

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);
   

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics