lujun1949

hibernate 中根据id删除一条记录的语句

qid name like content
1 A 1 the first text
2 B 2 the Second text
1 C 3 the Third text

 

 

如上表所示,当我们需要某个qid执行删除操作时,可以按照如下语句进行执行

 1         String hql="from bbsLikes  b where b.qid=(:ID)";
 2         String[] paramName={"ID"};
 3         Object[] value={qid}; 5         List list = this.getHibernateTemplate().findByNamedParam(hql, paramName, value);        
 6         if(!list.isEmpty()){
 7             this.getHibernateTemplate().deleteAll(list);
 8             return true;
 9         }
10         return false;    
11     }

 

分类:

技术点:

相关文章:

  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
猜你喜欢
  • 2022-12-23
  • 2021-12-25
  • 2021-05-28
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-27
相关资源
相似解决方案