hibernate使用sessionfactory插入数据

1.引入hibernate-core.jar

2.java代码

 

public void meth{
Session session = sessionFactory.openSession();
        Transaction tr = session.beginTransaction();
        //1.创建Customer对象
        //2.调用Session的save()方法,将Customer对象持久化
        session.save(jbpmTaskInherit);
        tr.commit();
        session.close();

}

 

posted @ 2018-10-29 16:47  西门燕儿  阅读(473)  评论(0编辑  收藏  举报