public class HibernateDaoSupportCash [b]extends HibernateDaoSupport[/b]{
/** 基于HQL的批量删除 */
public boolean zteHqlDelete(String hqlDelete){
boolean r = false;
Session session = getSession();
Transaction t = session.beginTransaction();
try{
[b]session.createQuery( hqlDelete ).executeUpdate();[/b] 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");
}
}
/** 基于HQL的批量删除 */
public boolean zteHqlDelete(String hqlDelete){
boolean r = false;
Session session = getSession();
Transaction t = session.beginTransaction();
try{
[b]session.createQuery( hqlDelete ).executeUpdate();[/b] 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");
}
}