I would do this with a custom retrieve action like this
I use limit and offsets because if there are a couple of thousend records your server will run out of memory. This way you proces the entity in batches. Once you have this list you can iterate over the list and change the attribute. Do not commit inside the iteration. It is more efficient to do it outside of the iteration and just commit the list.
You also need to do acount of the list. If that count is the same as your limit you have not yet processed all records and you not to change your offset and add the limit value to the offset value and do the retrieve again.
Something like this:
Hope this helps.
Regards,
Ronald