我查了一下不知道对不对
首先在sessionimpl中有executeall这个方法来执行操作,executeall里面执行到batcher里面的executeBatch(),这个方法如下:
public void executeBatch() throws HibernateException {
if (batchUpdate!=null) {
final PreparedStatement ps = batchUpdate;
batchUpdate=null;
batchUpdateSQL=null;
try {
try {
doExecuteBatch(ps);
}
finally {
closeStatement(ps);
}
}
catch (SQLException sqle) {
throw new JDBCException("Could not execute JDBC batch update", sqle);
}
}
}
所以应该是执行一个操作比如insert后,Hibernate就会自己关闭statement