From cc0ea4a824e9929c6bc74f952e75bf6d282ef5c0 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 29 Mar 2013 00:19:43 +0100 Subject: [PATCH] Removed deprecated saveOrUpdateAll method from HibernateOperations --- .../orm/hibernate3/HibernateOperations.java | 15 +-------------- .../orm/hibernate3/HibernateTemplate.java | 14 +------------- .../orm/hibernate3/HibernateTemplateTests.java | 15 --------------- 3 files changed, 2 insertions(+), 42 deletions(-) diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java index 3d142f2256d..c284afd9356 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateOperations.java @@ -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. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java index 1edc733d3bd..43765e5e235 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/HibernateTemplate.java @@ -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() { - 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 { diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java index 07fdf5e6b8e..6da7999ca78 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/HibernateTemplateTests.java @@ -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();