You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2013/07/10 17:33:49 UTC

L2 cache && em.find()?

Hi,

with a colleague we noticed today this behavior:

1) we activated the L2 cache
2) we have an entity Foo with a relationship 1-n in eager mode
3) we test the cache is correctly use
     a) we call em.find(Foo.class, id) -> entity is cached but not the
relationship so a query is generated for each find
     b) if we replace the em.find() by a query "select by id" all works
fine (cache is used and we don't see any query then)


Any idea?

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*

Re: L2 cache && em.find()?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Ill have a look on monday, i tested with a trivial case and it worked,
maybe linked to the idclass of the entity in the relationship.
Le 12 juil. 2013 21:22, "Rick Curtis" <cu...@gmail.com> a écrit :

> Romain -
>
> This still sounds very similar to OPENJPA-2285... could you perhaps put
> together a small UT?
>
> Thanks,
> Rick
>
>
> On Wed, Jul 10, 2013 at 11:19 AM, Rick Curtis <cu...@gmail.com> wrote:
>
> > I actually reverted the changes from 2.3.0 and 2.2.2 (I'll change the fix
> > versions field) because the change wasn't kosher with regards to the
> spec.
> >
> >
> > On Wed, Jul 10, 2013 at 11:08 AM, Romain Manni-Bucau <
> > rmannibucau@gmail.com> wrote:
> >
> >> Not the same case since i'm in eager mode for the relationship and it
> >> still
> >> doesn't work on the 2.3.0-SNAPSHOT
> >>
> >> *Romain Manni-Bucau*
> >> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> >> *Blog: **http://rmannibucau.wordpress.com/*<
> >> http://rmannibucau.wordpress.com/>
> >> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> >> *Github: https://github.com/rmannibucau*
> >>
> >>
> >>
> >> 2013/7/10 Rick Curtis <cu...@gmail.com>
> >>
> >> > I'm not 100% certain that I'm following your scenario, but I worked
> on a
> >> > JIRA[1] a while back that sounds pretty similar.
> >> >
> >> > [1] https://issues.apache.org/jira/browse/OPENJPA-2285
> >> >
> >> > Thanks,
> >> > Rick
> >> >
> >> >
> >> > On Wed, Jul 10, 2013 at 10:33 AM, Romain Manni-Bucau
> >> > <rm...@gmail.com>wrote:
> >> >
> >> > > Hi,
> >> > >
> >> > > with a colleague we noticed today this behavior:
> >> > >
> >> > > 1) we activated the L2 cache
> >> > > 2) we have an entity Foo with a relationship 1-n in eager mode
> >> > > 3) we test the cache is correctly use
> >> > >      a) we call em.find(Foo.class, id) -> entity is cached but not
> the
> >> > > relationship so a query is generated for each find
> >> > >      b) if we replace the em.find() by a query "select by id" all
> >> works
> >> > > fine (cache is used and we don't see any query then)
> >> > >
> >> > >
> >> > > Any idea?
> >> > >
> >> > > *Romain Manni-Bucau*
> >> > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> >> > > *Blog: **http://rmannibucau.wordpress.com/*<
> >> > > http://rmannibucau.wordpress.com/>
> >> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> >> > > *Github: https://github.com/rmannibucau*
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > *Rick Curtis*
> >> >
> >>
> >
> >
> >
> > --
> > *Rick Curtis*
> >
>
>
>
> --
> *Rick Curtis*
>

Re: L2 cache && em.find()?

Posted by Rick Curtis <cu...@gmail.com>.
Romain -

This still sounds very similar to OPENJPA-2285... could you perhaps put
together a small UT?

Thanks,
Rick


On Wed, Jul 10, 2013 at 11:19 AM, Rick Curtis <cu...@gmail.com> wrote:

> I actually reverted the changes from 2.3.0 and 2.2.2 (I'll change the fix
> versions field) because the change wasn't kosher with regards to the spec.
>
>
> On Wed, Jul 10, 2013 at 11:08 AM, Romain Manni-Bucau <
> rmannibucau@gmail.com> wrote:
>
>> Not the same case since i'm in eager mode for the relationship and it
>> still
>> doesn't work on the 2.3.0-SNAPSHOT
>>
>> *Romain Manni-Bucau*
>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>> *Blog: **http://rmannibucau.wordpress.com/*<
>> http://rmannibucau.wordpress.com/>
>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> *Github: https://github.com/rmannibucau*
>>
>>
>>
>> 2013/7/10 Rick Curtis <cu...@gmail.com>
>>
>> > I'm not 100% certain that I'm following your scenario, but I worked on a
>> > JIRA[1] a while back that sounds pretty similar.
>> >
>> > [1] https://issues.apache.org/jira/browse/OPENJPA-2285
>> >
>> > Thanks,
>> > Rick
>> >
>> >
>> > On Wed, Jul 10, 2013 at 10:33 AM, Romain Manni-Bucau
>> > <rm...@gmail.com>wrote:
>> >
>> > > Hi,
>> > >
>> > > with a colleague we noticed today this behavior:
>> > >
>> > > 1) we activated the L2 cache
>> > > 2) we have an entity Foo with a relationship 1-n in eager mode
>> > > 3) we test the cache is correctly use
>> > >      a) we call em.find(Foo.class, id) -> entity is cached but not the
>> > > relationship so a query is generated for each find
>> > >      b) if we replace the em.find() by a query "select by id" all
>> works
>> > > fine (cache is used and we don't see any query then)
>> > >
>> > >
>> > > Any idea?
>> > >
>> > > *Romain Manni-Bucau*
>> > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>> > > *Blog: **http://rmannibucau.wordpress.com/*<
>> > > http://rmannibucau.wordpress.com/>
>> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> > > *Github: https://github.com/rmannibucau*
>> > >
>> >
>> >
>> >
>> > --
>> > *Rick Curtis*
>> >
>>
>
>
>
> --
> *Rick Curtis*
>



-- 
*Rick Curtis*

Re: L2 cache && em.find()?

Posted by Rick Curtis <cu...@gmail.com>.
I actually reverted the changes from 2.3.0 and 2.2.2 (I'll change the fix
versions field) because the change wasn't kosher with regards to the spec.


On Wed, Jul 10, 2013 at 11:08 AM, Romain Manni-Bucau
<rm...@gmail.com>wrote:

> Not the same case since i'm in eager mode for the relationship and it still
> doesn't work on the 2.3.0-SNAPSHOT
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/7/10 Rick Curtis <cu...@gmail.com>
>
> > I'm not 100% certain that I'm following your scenario, but I worked on a
> > JIRA[1] a while back that sounds pretty similar.
> >
> > [1] https://issues.apache.org/jira/browse/OPENJPA-2285
> >
> > Thanks,
> > Rick
> >
> >
> > On Wed, Jul 10, 2013 at 10:33 AM, Romain Manni-Bucau
> > <rm...@gmail.com>wrote:
> >
> > > Hi,
> > >
> > > with a colleague we noticed today this behavior:
> > >
> > > 1) we activated the L2 cache
> > > 2) we have an entity Foo with a relationship 1-n in eager mode
> > > 3) we test the cache is correctly use
> > >      a) we call em.find(Foo.class, id) -> entity is cached but not the
> > > relationship so a query is generated for each find
> > >      b) if we replace the em.find() by a query "select by id" all works
> > > fine (cache is used and we don't see any query then)
> > >
> > >
> > > Any idea?
> > >
> > > *Romain Manni-Bucau*
> > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > http://rmannibucau.wordpress.com/>
> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > *Github: https://github.com/rmannibucau*
> > >
> >
> >
> >
> > --
> > *Rick Curtis*
> >
>



-- 
*Rick Curtis*

Re: L2 cache && em.find()?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Not the same case since i'm in eager mode for the relationship and it still
doesn't work on the 2.3.0-SNAPSHOT

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/7/10 Rick Curtis <cu...@gmail.com>

> I'm not 100% certain that I'm following your scenario, but I worked on a
> JIRA[1] a while back that sounds pretty similar.
>
> [1] https://issues.apache.org/jira/browse/OPENJPA-2285
>
> Thanks,
> Rick
>
>
> On Wed, Jul 10, 2013 at 10:33 AM, Romain Manni-Bucau
> <rm...@gmail.com>wrote:
>
> > Hi,
> >
> > with a colleague we noticed today this behavior:
> >
> > 1) we activated the L2 cache
> > 2) we have an entity Foo with a relationship 1-n in eager mode
> > 3) we test the cache is correctly use
> >      a) we call em.find(Foo.class, id) -> entity is cached but not the
> > relationship so a query is generated for each find
> >      b) if we replace the em.find() by a query "select by id" all works
> > fine (cache is used and we don't see any query then)
> >
> >
> > Any idea?
> >
> > *Romain Manni-Bucau*
> > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > *Blog: **http://rmannibucau.wordpress.com/*<
> > http://rmannibucau.wordpress.com/>
> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > *Github: https://github.com/rmannibucau*
> >
>
>
>
> --
> *Rick Curtis*
>

Re: L2 cache && em.find()?

Posted by Rick Curtis <cu...@gmail.com>.
I'm not 100% certain that I'm following your scenario, but I worked on a
JIRA[1] a while back that sounds pretty similar.

[1] https://issues.apache.org/jira/browse/OPENJPA-2285

Thanks,
Rick


On Wed, Jul 10, 2013 at 10:33 AM, Romain Manni-Bucau
<rm...@gmail.com>wrote:

> Hi,
>
> with a colleague we noticed today this behavior:
>
> 1) we activated the L2 cache
> 2) we have an entity Foo with a relationship 1-n in eager mode
> 3) we test the cache is correctly use
>      a) we call em.find(Foo.class, id) -> entity is cached but not the
> relationship so a query is generated for each find
>      b) if we replace the em.find() by a query "select by id" all works
> fine (cache is used and we don't see any query then)
>
>
> Any idea?
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>



-- 
*Rick Curtis*