锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
public class AddMoreWords {
聽private static String type = "idiom";
聽/**
聽 * @param args
聽 */
聽public static void main(String[] args) throws Exception {
聽聽// TODO Auto-generated method stub
聽聽
聽聽Session session = HibernateSessionFactory.currentSession();
聽聽Transaction txc = session.beginTransaction();
聽聽for(int i=0;i<1000;++i){
聽聽聽WordLib word = new WordLib();
聽聽聽word.setChn("mm"+(i+1));
聽聽聽word.setTime(new Date());
聽聽聽word.setType(type);
聽聽聽session.save(word);
聽聽聽if((i+1)%25 == 0){
聽聽聽聽session.flush();
聽聽聽聽session.clear();
聽聽聽}
聽聽}
//聽聽WordLib word = new WordLib();
//聽聽word.setChn("a");
//聽聽word.setTime(new Date());
//聽聽word.setType(type);
//聽聽session.save(word);
聽聽txc.commit();
聽聽HibernateSessionFactory.closeSession();
聽聽session.flush();
聽聽session.close();
聽}
}