I guess I am sending the email to this list becuase some people working on
openjpa are making statement on the web - podcast - etc... that they have
done for openjpa a great integration with Tangosol cache. I think his name
is David Linskey or something like that - anyhow it does not matter...
In any case - I am just trying to understand what is possible and what is
not with openjpa as it relates to L2 cache.
I think Tangosol plug in for openjpa is totally different - they are
promoting the use of Tangosol first with a backing map that uses openjpa
for the persistence to the DB. The problem with their approach is that I am
loosing all the benift of the openjpa O/R mapping and relationship
management in particular.
So I am using the opnejpa approach first - which means the L2 cache is on
the side. And I believe I am only using openjpa code - meaning the
persistence xml defines the following:
<property name="kodo.DataCache"
value="tangosol(TangosolCacheName=a,TangosolCacheType=named,ClearOnClose=false)"/>
This - I believe - is a regular openjpa functionality. Isn't it?
So my question is why when I specify the data cache annotation - openjpa
does not honor this particular cache for this particular entity?
@DataCache(enabled = true, name =
"tangosol(TangosolCacheName=b,TangosolCacheType=named,ClearOnClose=false)",
timeout = -1)
I just want to specify which L2 cache to use per entity.
Becuase if I do it at the EntityManagerFactory - then all entities will
have to use the same cache. Which would mean that I would need to consider
all the data to be equal in terms of how it is used by the system - which
of course is not correct and will remove the performance benefit of using
an L2 cache (well most of them - some will remain - but for sure it would
be a shame). Think about a clustered application with data being clustered
and other being local only and you see what I mean by loosing pretty much
all benefit from L2 cache - (welcome to serialization overhead nightmare...
;) - my performance will be terrible - plus it would be such a bad design
for the application anyhow.
The openjpa doc talks about specifying the L2 cache by name per enity via
the DataCache annotation. I would like to understand how I can use it.
Becuase it seems to be exactly what I need. Except that I can not make it
work with Tangsol.
I am ssuming that all entities of an object graph are stored in the L2
cache sperately - and not as one big serialized blob for the entire graph.
That way when I query for an object deep in my graph I would be able to get
it from the cache easily. If so then I would think that assigning each
entity to a specific cache would be trivial.
BTW - in your previous email I am assuming you are refering to the
entityManagerFactory and not the Entitymanager because the L2 cache is at
the Factory level and not the entityManager level - otherwise obviously it
would not be usefull at all ;) . (Your L1 cache is - and the Tx too of
course).
Frederic
"Kevin Sutter"
<[EMAIL PROTECTED]
om> To
[email protected]
cc
03/27/2008 12:32
PM Subject
Re: How to set a tangosol cache per
entity?
Please respond to
[EMAIL PROTECTED]
che.org
Frederic,
I'm not an expert with the Tangosol plugin, but in general, the OpenJPA
DataCache plugin is on a per-EntityManager basis. So, if configured, all
Entities associated with a given PersistenceContext (EntityManager) could
be
cached. You then have the ability to designate certain Entities as being
non-cached. Or, you could go in reverse and designate only those Entities
that you do wish to cache.
If your question is more specific to the Tangosol plugin, then you'll have
to ask the development team that developed that plugin. BEA? Tangosol?
Not sure. The OpenJPA code only supports the DataCache plugin capabilities
(and the built-in DataCache implementation). The other cache plugins (ie,
Tangosol, ObjectGrid, etc) are supported by other development
organizations.
Thanks,
Kevin
On Thu, Mar 27, 2008 at 1:00 PM, <[EMAIL PROTECTED]> wrote:
>
> I need to have a specific tangosol cache per entity - (or at least per
> group of entity):
>
> I am trying to use the annotation @DataCache to make this happen -
> unfortunately it does not work. openjpa always uses the tangosol cache
> define din the persistence xml file - basically the default cache.
>
> I tried to set the @DataCache annotation to:
> @DataCache(enabled = true, name =
>
>
"tangosol(TangosolCacheName=b,TangosolCacheType=named,ClearOnClose=false)",
> timeout = -1)
>
> I also tried
> @DataCache(enabled = true, name = "b", timeout = -1)
>
> But none format worked. Again - all entities are currently going to the
> default Tangosol cache.
>
> It is a must for our project to be able to cache our entities in specific
> cache (We are using Tangosol). Using one cache only for all entities in
> the
> system almost removes all the benefit of the cache all together - and we
> might as well not have one.
>
> How can I accomplish that?
> Should I implement our own RemoteCommitProvider? (This seems complicated
> becuase I do not know all the internal of openjpa)
> Can I use the entity callback method to talk to the cache myself? (This
> seems easy) - but in order to use it I need to be sure all entity
callback
> methods will be called even when I save a top level object in the graph -
> I
> mean I need all the other entities related to the parent one to have teir
> callback fired if they get saved too.
>
> Please help - this is a huge issue for us.
>
> Thank you,
>
> Frederic
>
>
>