????Hibernate????????????????????????????????????????????????????????????????????????????????????????????????Session??delete()???????????????????Hibernate??????????????????????????????г????????setter???????Hibernate?????????????update???????????????????

???????????????????????????100000????????????????????100000?????????????ε???setter????——?????????????????????????????????????????????????????????Hibernate???????????????????????????????????????????o?????????????????????????????????????????Ρ?

????????????

????????????100000?????????????????Hibernate??????????????????


1.Session session = sessionFactory.openSession(); 
2.Transaction tx = session.beginTransaction(); 
3.//???100000????????100000?????
4.for ( int i=0; i<100000; i++ ) 
5.{ 
6.    User u = new User (.....); 
7.    session.save(u); 
8.} 
9.tx.commit(); 
10.session.close();
 


?????????????????????У???????????????????????????OutOfMemoryException?????????????????????Hibernate??Session??????????????????棬???е?User?????????Session????????????????????????

?????????????????и?????????·???????Session???????????????????????????Session?????檔????????????????????????????User??????????????1??????????????????????????Session?????е?????????????

??????????????100000??User??????????Ρ?

?????????嵥??codes