[hibernate-dev] Closed: (HHH-7160) Method NaturalIdXrefDelegate#cache() misses to remove obsolete entry in naturalIdToPkMap when NaturalId values changed
Steve Ebersole
steve at hibernate.org
Thu Mar 15 11:52:34 EDT 2012
I reopened it and gave it a more pertinent subject. Working on other
stuff atm, so help here would be appreciated. Only part of
evictNaturalIdResolution needs to be called here. I would look at
extracting a method from the part of evictNaturalIdResolution that
handles the shared cache and using that in NaturalIdXrefDelegate#cache()
On Thu 15 Mar 2012 10:29:44 AM CDT, Demetz, Guenther wrote:
> Hi Steve,
>
> in HHH-7160 we forgot to consider the 2nd-Level-Cache when removing the key from naturalIdToPkMap:
>
> private static class NaturalIdResolutionCache implements Serializable {
> ...
> final CachedNaturalId initial = pkToNaturalIdMap.get( pk );
> if ( initial != null ) {
> if ( areSame( naturalIdValues, initial.getValues() ) ) {
> return false;
> }
> naturalIdToPkMap.remove( initial ); // OK for first level-cache,
> // but if persister.hasNaturalIdCache() then CachedNaturalId must also be evicted from second level cache too
>
> The dilemma:
> non-static method evictNaturalIdResolution cannot be called here ( we are in a static context)
>
> I have already test-case which demonstrates the bug:
> session.bySimpleNaturalId(...).load(obsolete_key) resolves and returns object from 2nd-LevelCache
>
> How should I proceed? Should I open another issue for this?
>
> best regards
> Guenther
>
>
> -----Original Message-----
> From: Steve Ebersole (JIRA) [mailto:noreply at atlassian.com]
> Sent: Thursday, March 15, 2012 12:02 AM
> To: Demetz, Guenther
> Subject: [Hibernate-JIRA] Closed: (HHH-7160) Method NaturalIdXrefDelegate#cache() misses to remove obsolete entry in naturalIdToPkMap when NaturalId values changed
>
>
> [ https://hibernate.onjira.com/browse/HHH-7160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Steve Ebersole closed HHH-7160.
> -------------------------------
>
> Resolution: Out of Date
>
> This was already addressed as part of another issue
>
>> Method NaturalIdXrefDelegate#cache() misses to remove obsolete entry
>> in naturalIdToPkMap when NaturalId values changed
>> ----------------------------------------------------------------------
>> ------------------------------------------------
>>
>> Key: HHH-7160
>> URL: https://hibernate.onjira.com/browse/HHH-7160
>> Project: Hibernate ORM
>> Issue Type: Bug
>> Components: core
>> Affects Versions: 4.1.1
>> Environment: Hibernate4.1.1
>> Reporter: Guenther Demetz
>> Labels: naturalId
>> Attachments: TestCaseNaturalIdChangeBetweenPersistAndFlush.jar
>>
>> Original Estimate: 1h
>> Remaining Estimate: 1h
>>
>> Method NaturalIdXrefDelegate#cache() misses to remove obsolete entry
>> in naturalIdToPkMap when NaturalId values changed, thus NaturalIdAccess delivers results even by searching with obsolete values (see attached Testcase).
>> Cause:
>> following instruction is missing in Method NaturalIdXrefDelegate#cache():
>> if ( initial != null ) {
>> if ( areSame( naturalIdValues, initial.getValues()) ) {
>> return false;
>> }
>> naturalIdToPkMap.remove(initial); //<-- this instruciton is missing
>> }
>
> --
> This message is automatically generated by JIRA.
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
--
steve at hibernate.org
http://hibernate.org
More information about the hibernate-dev
mailing list