标签:
accepted |
There‘s a very nice chapter about batch processing in the Hibernate docs. Set the property hibernate.jdbc.batch_size 20 Then use this code Session session = sessionFactory.openSession();Transaction tx = session.beginTransaction();for ( int i=0; i<100000; i++ ) { Customer customer = new Customer(.....); session.save(customer); if ( i % 20 == 0 ) { //20, same as the JDBC batch size //flush a batch of inserts and release memory: session.flush(); session.clear(); }} |
hibernate批量插入collection,同一类实体,不通实例
标签:
原文地址:http://my.oschina.net/lilinzero/blog/529659