Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to update tables from back end that it reflects in retrieved entities
    primarykey
    data
    text
    <p>I'm developing a Spring MVC web application using Windows 7, Eclipse Juno, Eclipselink JPA as ORM and Glassfish as application server with Oracle 11g. While I was working with Eclipselink I noticed when I update a table manually by execute an update PL/SQL query it doesn't has any affect on entities that already retrieved by Eclipselink until restart the server. Although, I disabled Eclipselink cache by having <code>&lt;shared-cache-mode&gt;NONE&lt;/shared-cache-mode&gt;</code> in persistance.xml and using <code>EntityManager.clear()</code>, <code>EntityManager.close()</code> and <code>@Cacheable(false)</code>.</p> <p>Then, I noticed when I update tables using Oracle-SQLDeveloper table designer it totally works fine and entities are showing updated information. So I checked SQLDeveloper log to see what query it's using to update rows and I saw that it's using ORA_ROWSCN and ROW ROWID in where clause. After that, I exactly used the same where clause as the one SQLDeveloper used to update tables, but still entities were showing old information.</p> <p>I'm wondering what factors are involved here that Eclipslink is not fetching real time data from database ? but, after updating table with SQLDeveloper designer Eclipselink is showing real time data. It seems that modifying a table data with SQLDeveloper table designer also marks the table as changed by using some database features. Then, Eclipselink will read the mark before hitting the table.</p> <p>Also to get more clarification, anyone knows what steps are involved in Eclipselink before it decides to hit database when user commands to execute a TypedQuery ? I'm so curious that where it stores cached entities ? since cache rest just by restarting the computer; I tried restarting Glassfish, killing the java process and logoff current user, but none of them worked. Why Eclipselink still is caching entities since I configured it to not use any caching procedure? Is it possible to completely turn off cache in Eclipselink?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. CODoesn't sound like an EclipseLink cache issue at all - if you shut down the VM EclipseLink is running (ie the glassfish server) in then it doesn't have a cache. How are you issuing your PL/SQL queries and are you committing your transaction afterward? Are these changes visible to SQLDeveloper?
      singulars
    2. COI tried to stop Glassfish domain by using `asadmin -stop-domain`, but still after get started Eclipselink is returning old entities. I'm wondering from where ? I'm executing PL/SQL queries by writing them in a SQL file in Oracle SQLDeveloper. When I use Eclipselink to update entities I can see expected changes in tables by using a SQL file in SQLDeveloper. I guess [link] (http://stackoverflow.com/questions/16331621/how-to-refresh-updated-entity-data-without-restarting-the-server) has the same problem.
      singulars
    3. COI doubt it for the reason I mentioned - EclipseLink runs in the JVM, so when it closes down, there is no cache. Same with the webserver; if you shut it down and still see stale database data when it starts back up, something else is the culprit. You can verify by calling em.refresh() on the stale entity. Focus on how you are making changes when EclipseLink can't see the changes - are you able to connect through JDBC or a native SQL query on the app server to see the changes?
      singulars
 

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