openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: ManagedCache cache issues?
Date Thu, 12 Jan 2012 00:04:14 GMT
Sorry, I haven't looked at your JIRA yet... but in your example, wouldn't
Address and Customer have a different OpenJPAId.type, so we shouldn't have
this collision that you pointed out?

On Wed, Jan 11, 2012 at 4:58 PM, Mark Struberg <struberg@yahoo.de> wrote:

> hi!
>
> I'm debugging through a weird bug I have here locally. While doing that I
> figured that the the cache could suffer from clashes
>
>
>
> ManagedCache.java
>
> StateManagerImpl orig = _main.put(sm.getObjectId(), sm);
>
> the problem is that the same instance of the ManagedCache is being used
> for different Entities. But for different entities, the ids could be
> overlapping!
>
> I'm e.g. using
> <property name="openjpa.Sequence" value="class-table(Table=SEQUENCES,
> Increment=20, InitialValue=10000)"/>
>
> Which means that there could be a Customer with id=10001 and an Address
> with id=10001.
> Some query which would touch both would create a clash in the ManagedCache.
>
> It might (and reasonably ok performance wise) be safe to add something like
>
> int entityHash = sm.getPersistenceCapable().getClass().hashCode();
>
> StateManagerImpl orig = _main.put(entityHash + (29 * sm.getObjectId()),
> sm);
>
>
> wdyt?
>
> LieGrue,
> strub
>



-- 
*Rick Curtis*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message