Removed deprecated saveOrUpdateAll method from HibernateOperations

This commit is contained in:
Juergen Hoeller 2013-03-29 00:19:43 +01:00
parent 541f3edd9e
commit cc0ea4a824
3 changed files with 2 additions and 42 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -433,19 +433,6 @@ public interface HibernateOperations {
*/
void saveOrUpdate(String entityName, Object entity) throws DataAccessException;
/**
* Save or update all given persistent instances,
* according to its id (matching the configured "unsaved-value"?).
* Associates the instances with the current Hibernate {@code Session}.
* @param entities the persistent instances to save or update
* (to be associated with the Hibernate {@code Session})
* @throws DataAccessException in case of Hibernate errors
* @deprecated as of Spring 2.5, in favor of individual
* {@code saveOrUpdate} or {@code merge} usage
*/
@Deprecated
void saveOrUpdateAll(Collection entities) throws DataAccessException;
/**
* Persist the state of the given detached instance according to the
* given replication mode, reusing the current identifier value.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -753,18 +753,6 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
});
}
public void saveOrUpdateAll(final Collection entities) throws DataAccessException {
executeWithNativeSession(new HibernateCallback<Object>() {
public Object doInHibernate(Session session) throws HibernateException {
checkWriteOperationAllowed(session);
for (Object entity : entities) {
session.saveOrUpdate(entity);
}
return null;
}
});
}
public void replicate(final Object entity, final ReplicationMode replicationMode)
throws DataAccessException {

View File

@ -815,21 +815,6 @@ public class HibernateTemplateTests {
verify(session).close();
}
@Test
public void testSaveOrUpdateAll() throws HibernateException {
TestBean tb1 = new TestBean();
TestBean tb2 = new TestBean();
given(session.getFlushMode()).willReturn(FlushMode.AUTO);
List tbs = new ArrayList();
tbs.add(tb1);
tbs.add(tb2);
hibernateTemplate.saveOrUpdateAll(tbs);
verify(session).saveOrUpdate(same(tb1));
verify(session).saveOrUpdate(same(tb2));
verify(session).flush();
verify(session).close();
}
@Test
public void testReplicate() throws HibernateException {
TestBean tb = new TestBean();