Note that there are some explanatory texts on larger screens.

plurals
  1. POEclipselink Individual Class Cache Configuration
    text
    copied!<p>I added a new boolean field (<code>myFlag</code>) to an existing class (<code>MyClass</code>). </p> <p>On the JSP side, I added the following code (<code>myClassObject</code> was passed as a request attribute).</p> <pre><code>&lt;span onclick="toggleMyFlag()"&gt; &lt;c:choose&gt; &lt;c:when test="${myClassObject.myFlag}"&gt; &lt;c:out value="TRUE" /&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;c:out value="FALSE" /&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/span&gt; </code></pre> <p>When the <code>span</code> is clicked, the flag on the entity is successfully toggled (I can view the change in the database, etc). </p> <p>However, when the page reloads the TRUE or FALSE outputs have not updated correctly (they remain the same). Refreshing the page doesn't work. Logging out and back in doesn't. And closing the browser doesn't. The only way it seems to fix itself is if I restart my local server.</p> <p>I tried the following with no luck.</p> <pre><code>response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", 0); </code></pre> <p>I also tried the following on my query, again without luck.</p> <pre><code>query.setHint(QueryHints.REFRESH, HintValues.TRUE); </code></pre> <p>Then I found that if I changed the following property (in <code>persistence.xml</code>) to be false, the functionality worked.</p> <pre><code>&lt;property name="eclipselink.cache.shared.default" value="true"/&gt; </code></pre> <p>However, I do not want to turn off all caching like that. </p> <p>I don't know anything about EclipseLink, so I was wondering if it is possible to turn off caching for just <code>MyClass</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload