Bug in SharedCache handling of Natural-id

Description

Although configuring org.hibernate.cache.LookupNaturalId cache region large enough and eternal, I always have Warning messages like following:

Debugging into hibernate, I detected that strangely at certain point in StatefulPersistenceContext.java
method RegionAccessStrategy#unlockRegion ist called, without ever calling lockRegion.
This unlockRegion call (in EHCache it clears the entire region!) has no sense here,
with evidency the removal of previousCacheKey item was intended here indeed.
Please see the pullrequest, it makes the warnings above dissappear.

Environment

EHCache as shared cache implementation, using read-write strategy

Status

Assignee

Steve Ebersole

Reporter

Guenther Demetz

Fix versions

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure