How Hibernate Batch insert works?
问题 Can some one explain me how hibernate.jdbc.batch_size=1000 and if (i % 100 == 0 && i>0) { session.flush(); session.clear(); } together works ? ... 回答1: Hibernate property hibernate.jdbc.batch_size is a way for hibernate to optimize your insert or update statetment whereas flushing loop is about memory exhaustion. Without batchsize when you try to save an entity hibernate fire 1 insert statement, thus if you work with a big collection, for each save hibernate fire 1 statement Imagine the