users@glassfish.java.net

Re: Clear toplink cache from command line

From: <glassfish_at_javadesktop.org>
Date: Fri, 09 Jul 2010 16:42:44 PDT

It's not Glassfish that's caching - it's Toplink. The caching behaviour improves performance but is not suitable for your needs. There are three options to fix your situation-

1. add the toplink.cache.shared.default property to your persistence.xml to disable the second level cache:

<persistence-unit name="blah" transaction-type="JTA">
        <properties>
            <!-- disable ALL caching -->
            <property name="toplink.cache.shared.default" value="false"/>
        </properties>

All hits will now go to the database during each client session.

2. change to Eclipselink and configure caching timeouts (much better and easier to do - highly recommended)

3. use Hibernate and configure caching through ehcache (more complicated but still good)

We had the problem you described and fixed using (1). Since then we have moved to Eclipselink 2 and found it to be a *much* nicer solution (Eclipselink is actually Toplink donated to the Eclipse foundation).

Hope this helps

Gerald
[Message sent by forum member 'ggierer']

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