`
Cash
  • 浏览: 176407 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

spring + hibernate3.0.5 的批量删除解决方案

阅读更多
public class HibernateDaoSupportCash extends HibernateDaoSupport{

/** 基于HQL的批量删除 */
public boolean zteHqlDelete(String hqlDelete){
boolean r = false;
Session session = getSession();
Transaction t = session.beginTransaction();
try{
session.createQuery( hqlDelete ).executeUpdate(); r = true;
t.commit();
session.close();
}catch(Exception e){
t.commit();
session.close();
System.out.println("批量删除异常:");
e.printStackTrace();
}
return r;
}

public static void main(String[] arg){
    ApplicationContext context = new ClassPathXmlApplicationContext("HibernateContext.xml");

    }


}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics