I do data processing that I can't or don't want to do on the database level, I use streams:
I need to filter users according to some algorithms and then set the name for the users found to database.
userRepository
.findAll()
.stream()
.filter(isFourierTransform())
.forEach(i ->i.setName("Fourier");
Unfortunately, the above code does not save anything to database.
Below the working code
List<User>user=userRepository
.findAll()
.stream()
.filter(isFourierTransform())
.collect(Collectors.toList());
for(User user:u)
{
user.setName("")
}
userRepository.save(user);
how to make the first example work?