JpaSaveAll source

@Transactional @Override public <S extends T> List<S> saveAll(Iterable<S> entities) { Assert.notNull(entities, "Entities must not be null!" ); List<S> result = new ArrayList<S>(); For (entities) {for (entities) {for (entities) {for (entities) {for (entities) {for (entities); } return result; } @Transactional @Override public <S extends T> S Save (S Entity) {}} @Transactional @Override public <S extends T> S Save (S Entity) (entityInformation.isNew(entity)) { em.persist(entity); return entity; } else { return em.merge(entity); }}

6.4.1 Bulk inserts

The solution is to do your own persistent insert with em, saving you a query.

@PersistenceContext

private EntityManager entityManager;

@Override

@Transactional(rollbackFor = Exception.class)

public void addBatch(List list) {

for (ProjectApplyDO projectApplyDO : list) {

entityManager.persist(projectApplyDO); //insert insert operation

}

entityManager.flush();

entityManager.clear();

}

6.4.2 Batch Update

EntityManager.persist (ProjectApplyDo) above can be replaced by the following code if you are making sure that the data already exists; Statement:

entityManager.merge(projectApplyDO); //update operation