Hi Marc,

If you are using OpenJPA 1.x, specifying
@org.apache.openjpa.persistence.DataCache(enabled=false) annotation on your
inventory entities will inform OpenJPA that these entities should not be
cached.  If you are using OpenJPA 2.x, you have a few more options.  You can
continue to use the OpenJPA specific @DataCache annotation or use the JPA
2.0 standard @javax.persistence.Cacheable(false) annotation to prevent
inventory entities from being cached.  At an operation level, you can
specify the property "javax.persistence.cache.storeMode" with value of
javax.persistence.CacheStoreMode BYPASS on the finder or query to indicate
not to cache the result.

In addition, you could consider using LAZY fetch to not return the inventory
relation.  If that is too stringent, OpenJPA provides configurable fetch
groups[1] which let your further tune what should/should not be returned in
the query result.

hth,
Jeremy

[1] http://openjpa.apache.org/builds/latest/manual/ref_guide_fetch.html

On Mon, Sep 20, 2010 at 11:00 AM, killbulle <[email protected]> wrote:

>
> Hi ,
> we encounters a recently a little performance problem
> A class product(cached)  have a map off inventory (not Cached)
> when we retrieve the product in a new Entitymanager it generate a n+1
> select
> with a find all
> method.
> Is there a way to not cache the collection stub (1 - inventory...) ?
> Regards
> Marc
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/DataCache-on-Class-with-a-collection-of-DataCache-off-n-1-select-tp5551060p5551060.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Reply via email to