Experience the real struts development (5)

zhaozj2021-02-17  58

Main file:

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 ();

}

}

}

My machine inserts 10,000 records in 2 seconds, efficient, and has an increase in memory.

^ _ ^, Experience it, leave SQL.

There is still other things today, this is here, now 22:43.

Project Download: Download

The same time as it is estimated, ^ _ ^.

转载请注明原文地址:https://www.9cbs.com/read-30028.html

New Post(0)