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