Can not prevent cache region from being cleared from second level cache on bulk update

Description

Bulk updates using queries or the criteria API can be used to avoid fetching an entity before executing the update. For example:

UPDATE User u SET u.deleted = true WHERE u.id = :id

In this case, the only modified entity is known, and the entity in question could be manually evicted from the second level cache.

Instead, the whole cache region is evicted through a BulkOperationCleanupAction, and I have not been able to find a workaround for this. Currently it seems like it'd require modifying the EntityPersister itself, as this is where the affected regions are taken from.

Environment

None

Assignee

Unassigned

Reporter

Erik

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Minor
Configure