DATAJPA-137 - Fixed deleteAll() handling.
SimpleJpaRepository now deletes entities 1 by 1 for a call to deleteAll() to ensure the cascades get triggered. Introduced deleteAllInBatch() that contains the old behaviour.
This commit is contained in:
@@ -32,7 +32,6 @@ import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -296,6 +295,19 @@ public class UserRepositoryTests {
|
||||
assertThat(repository.count(), is(0L));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAJPA-137
|
||||
*/
|
||||
@Test
|
||||
public void deleteAllInBatch() {
|
||||
|
||||
flushTestUsers();
|
||||
|
||||
repository.deleteAllInBatch();
|
||||
|
||||
assertThat(repository.count(), is(0L));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests cascading persistence.
|
||||
*/
|
||||
@@ -443,16 +455,6 @@ public class UserRepositoryTests {
|
||||
Arrays.asList(firstUser, secondUser)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void executesMethodWithNamedParametersCorrectly() throws Exception {
|
||||
|
||||
firstUser = repository.save(firstUser);
|
||||
secondUser = repository.save(secondUser);
|
||||
|
||||
assertThat(repository.findByLastnameOrFirstnameUnannotated("Oliver", "Arrasz"), hasItems(firstUser, secondUser));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void executesMethodWithNamedParametersCorrectlyOnMethodsWithQueryCreation() throws Exception {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user