您可以在这里快速查找:


 
您的位置: 编程学习 > C++/VC > 200601
文章分类

Java技术
2005: 03 04 05 06 07 08
09 10 11 12
2006: 01 02

Asp.net
2005: 07 08 09 10 11 12
2006: 01 02

VB编程
2006: 02

Asp编程
2005: 11 12
2006: 01 02

C++/VC
2005: 10 11 12
2006: 01 02

Delphi
2005: 12
2006: 01 02

其它

 本文章适合所有读者

体会真正的Struts开发(5)

yanghx2000

主文件:

public class OnlyTest {

    public static void main(String[] args) throws Exception {

       Configuration cfg = new Configuration().addClass(TestHBM.class);

       SchemaExport pTemp = new SchemaExport(cfg);

       pTemp.create(true, true);

       SessionFactory sf = cfg.buildSessionFactory();

       Session s = sf.openSession();

       try {

          

          

           TestHBM message = new TestHBM();

           long start = System.currentTimeMillis();

           for (int i = 0; i < 10000; i++) {

              message.setName(String.valueOf(i));

              message.setId(String.valueOf(i));

              s.save(message);

              s.flush();

              s.evict(message);

           }

           long end = System.currentTimeMillis();

           System.out.println(end-start);

          

       } finally {

           s.close();

       }

    }

}

我的机子插入10000条记录2秒中,高效吧,而且内存内有增加。

^_^,体会到了吧,离开SQL吧。

 

今天还有其他事,就道这儿,现在22:43。

工程下载:下载

 

与估计一样时间,^_^。