hibernate session.save() does not reflect in database

后端 未结 9 2124
臣服心动
臣服心动 2020-12-08 14:30

According to my understanding in hibernate (please confirm)

1- You have to session.close() if you get it by getSessionFactory().openSession()

9条回答
  •  执念已碎
    2020-12-08 15:04

    You forgot to commit .You should to commit.

    session.save(ac);
    // you should to add this bottom line  
    session.getTransaction().commit();
    

提交回复
热议问题