67,513
社区成员
发帖
与我相关
我的任务
分享
getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
session.connection().setAutoCommit(false);
Student stu1=new Student();
stu1.setName("aaaa");
session.save(stu1);
Student stu2 = new Student();
session.save(stu2);
session.flush();//向数据库发送sql
session.connection().commit();
return null;
}
});