[BAEL-2538] Updated to return int with @Modifying queries
This commit is contained in:
parent
dabbf763b6
commit
099a8c9ae7
|
@ -79,8 +79,8 @@ public interface UserRepository extends JpaRepository<User, Integer> , UserRepos
|
|||
void deactivateUsersNotLoggedInSince(@Param("date") LocalDate date);
|
||||
|
||||
@Modifying(clearAutomatically = true, flushAutomatically = true)
|
||||
@Query("delete User u where u.active = false")
|
||||
void deleteDeactivatedUsers();
|
||||
@Query("delete from User u where u.active = false")
|
||||
int deleteDeactivatedUsers();
|
||||
|
||||
@Modifying(clearAutomatically = true, flushAutomatically = true)
|
||||
@Query(value = "alter table USERS.USERS add column deleted int(1) not null default 0", nativeQuery = true)
|
||||
|
|
|
@ -501,11 +501,12 @@ public class UserRepositoryIntegrationTest {
|
|||
userRepository.save(usr01);
|
||||
userRepository.save(usr02);
|
||||
|
||||
userRepository.deleteDeactivatedUsers();
|
||||
int deletedUsersCount = userRepository.deleteDeactivatedUsers();
|
||||
|
||||
List<User> users = userRepository.findAll();
|
||||
assertEquals(1, users.size());
|
||||
assertEquals(usr01, users.get(0));
|
||||
assertEquals(1, deletedUsersCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue