users@glassfish.java.net

Is Toplinks second level cache cluster aware?

From: <glassfish_at_javadesktop.org>
Date: Fri, 03 Aug 2007 15:21:08 PDT

Basically, Toplink has two caches as I understand it.

One for each specific EntityManger, and then a second layer that is unique to the entire application.

Notably, if you use "em.find(...)", it will pull information from the 2nd level cache, rather than pulling it from the DB. And it's been stated that Toplink is essentially designed around this meme.

So the question is whether this cache is cluster aware.

If I have an app and deploy it across two machines.

In server A I have:
[code]
Customer c = em.find(Customer.class, custKey);
c.setName("John Smith");
[/code]

assuming this code commits properly, when I then have on server B:
[code]
Customer c = em.find(Customer.class, custKey);
[/code]
for the same key, will server B see the new name?

if I use a query to get the Customer, that would hit the DB, but em.find does not (necessarily) hit the DB.

Is the underlying JPA/Toplink cache doing this for me? And how long does the sync take?

Just curious where this may be described.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=229449