hibernate學(xué)習(xí)時,插入數(shù)據(jù),log沒問題,但數(shù)據(jù)庫中沒有該條記錄
在學(xué)習(xí)hibernate的時候,出現(xiàn)下列問題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是顯示成功的,但數(shù)據(jù)庫中沒有數(shù)據(jù),可我已經(jīng)session.flush()了啊?這是為什么?
還有就是如果用transaction就可以了
快快樂樂、認認真真生活才是真。
posted on 2007-09-19 15:52 鮑佩 閱讀(1590) 評論(4) 編輯 收藏 所屬分類: hibernate