hibernate session.save() does not reflect in database

后端 未结 9 2161
臣服心动
臣服心动 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:12

    Whenever Your are doing save(), Always commit the transaction once done.

    Account ac =new account()
    ac.insert(123);
    ----------
    ----------
    ----------
    ----------
    session.save(ac);
    
    // Add this bottom line  
    session.getTransaction().commit();
    

提交回复
热议问题