openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject Re: ManagedCache cache issues?
Date Thu, 12 Jan 2012 00:34:07 GMT
Oh yes, thanks for the pointer. 


sm.getObjectId() in fact returns a openjpa.util.LongId in my case and this contains the entity
information as well already.
I got just confused by the toString() which only showed my long...


So -> not a problem


LieGrue,
strub

>________________________________
> From: Rick Curtis <curtisr7@gmail.com>
>To: dev@openjpa.apache.org; Mark Struberg <struberg@yahoo.de> 
>Sent: Thursday, January 12, 2012 1:04 AM
>Subject: Re: ManagedCache cache issues?
> 
>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
View raw message