hibernate學習時,插入數據,log沒問題,但數據庫中沒有該條記錄
在學習hibernate的時候,出現下列問題Configuration config = new Configuration().configure();
SessionFactory sessionFactory = config.buildSessionFactory();
session = sessionFactory.openSession();
TbmStudent student = new TbmStudent();
student.setStudentNo("4587");
student.setStudentName("name4587");
student.setClassNo("B3");
student.setChinesePoint(69);
student.setMathematicsPoint(90);
student.setEnglishPoint(80);
student.setPhysicsPoint(60);
student.setChemistryPoint(79);
student.setModDate(new Date(System.currentTimeMillis()));
session.save(student);
session.flush();
log是顯示成功的,但數據庫中沒有數據,可我已經session.flush()了啊?這是為什么?
還有就是如果用transaction就可以了
快快樂樂、認認真真生活才是真。
posted on 2007-09-19 15:52 鮑佩 閱讀(1593) 評論(4) 編輯 收藏 所屬分類: hibernate