The reason is obvious from Java docs,
in favor of using a separate saveOrUpdate or merge
As you can see the implementation of the method, the code taken from the link,
public void saveOrUpdateAll(final Collection entities) throws DataAccessException { 768 executeWithNativeSession(new HibernateCallback() { 769 public Object doInHibernate(Session session) throws HibernateException { 770 checkWriteOperationAllowed(session); 771 for (Iterator it = entities.iterator(); it.hasNext();) { 772 session.saveOrUpdate(it.next()); 773 } 774 return null; 775 } 776 }); 777 }
This method has been less used; it cannot be inside your transaction. So spring wants you to iterate over the list and save individual objects.
The loadAll()
method is different and useful. It does not look like saveOrUpdateAll()
.
You are right with your observation that deleteAll()
is similar to saveOrUpdateAll()
, and I agree that it is incompatible, but it is deprecated and the other is not.
source share