support update entities stored in local tables inside foreach.
add spec