Spring Data JPA save list entity return list in same the order?
11,363
In that version an actual List is the return type:
@Transactional
public <S extends T> List<S> save(Iterable<S> entities) {
List<S> result = new ArrayList<S>();
if (entities == null) {
return result;
}
for (S entity : entities) {
result.add(save(entity));
}
return result;
}
so if you pass a List to the method, you will get the result in the exact same order as the ArrayList is the implementation.
Comments
-
tsarenkotxt almost 2 years
Does the method in Spring-Data-JPA's
CrudRepository
<S extends T> Iterable<S> saveAll(Iterable<S> entities)
return list in the same order ?