Browse Source

Removed deprecated saveOrUpdateAll method from HibernateOperations

pull/268/head
Juergen Hoeller 13 years ago
parent
commit
cc0ea4a824
  1. 15
      spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java
  2. 14
      spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java
  3. 15
      spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java

15
spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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.

14
spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java

@ -1,5 +1,5 @@ @@ -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 @@ -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 {

15
spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java

@ -815,21 +815,6 @@ public class HibernateTemplateTests { @@ -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();

Loading…
Cancel
Save