Removed deprecated saveOrUpdateAll method from HibernateOperations
This commit is contained in:
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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;
|
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
|
* Persist the state of the given detached instance according to the
|
||||||
* given replication mode, reusing the current identifier value.
|
* given replication mode, reusing the current identifier value.
|
||||||
|
|||||||
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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)
|
public void replicate(final Object entity, final ReplicationMode replicationMode)
|
||||||
throws DataAccessException {
|
throws DataAccessException {
|
||||||
|
|
||||||
|
|||||||
@@ -815,21 +815,6 @@ public class HibernateTemplateTests {
|
|||||||
verify(session).close();
|
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
|
@Test
|
||||||
public void testReplicate() throws HibernateException {
|
public void testReplicate() throws HibernateException {
|
||||||
TestBean tb = new TestBean();
|
TestBean tb = new TestBean();
|
||||||
|
|||||||
Reference in New Issue
Block a user