[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7309) Natural-id not cached in shared cache after insert

Guenther Demetz (JIRA) noreply at atlassian.com
Wed May 9 05:36:09 EDT 2012


Natural-id not cached in shared cache after insert 
---------------------------------------------------

                 Key: HHH-7309
                 URL: https://hibernate.onjira.com/browse/HHH-7309
             Project: Hibernate ORM
          Issue Type: Bug
          Components: caching (L2), testsuite
    Affects Versions: 4.1.3
         Environment: EHCache as 2L-cache implementation (or another 2L-cache implementation with default strict READ_WRITE access strategy)
            Reporter: Guenther Demetz
            Priority: Minor


Problem: 
when using a 2L-cache implementation with default strict READ_WRITE access strategy,
then after inserting/updating a new entity and committing, the concerning Natural-id is not cached in shared cache.

Cause: 
With strict READ_WRITE access strategy the improvement HHH-7279 "Prevent identical re-cachings in natural-id shared cache",
fails to prevent identical recachings for in-transaction-created entities, because with strict READ_WRITE the actual put is defered to transaction completition.
Recaching of identical natural-id-key, finally leaves the shared cache with valid entry.

Solution description(see following pullrequest):
To prove this in a hibernate matrix testcase, first I needed to enhance org.hibernate.testing.cache.CachingRegionFactory in manner that it also can return strict READ_WRITE as default access strategy, instead to always non-strict READ_WRITE.
Going deeper, I saw that org.hibernate.testing.cache.NonstrictReadWriteNaturalIdRegionAccessStrategy under some aspects was reflecting more a strict than a non-strict strategy,
this I fixed this and had finally convert CachingRegionFactory's default access type to strict READ_WRITE in order to have not a lot of matrix-testcases failing.
Further detail in following pullrequest...
 





--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list