You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by jmdiazlr <jm...@yahoo.com> on 2009/02/11 21:50:40 UTC

Can not retrieve concurrent updated data

I searched for this theme  and found several references but no solution.

My problem shows up when running two apps concurrently:

1. In application A: I execute a JPA Query, show results.
2. In concurrent application B: I update, insert and commit some objects.
3. In application A: I reexecute the JPA Query, show results, I get the old
data, the data before step 2 (but inserted rows are in the new results, that
is ok).

I know I have to Refresh the Objects, but this is a long result list with
only a few objects being updated concurrently, I do not want to Refresh all
the list, actually I saw in the logs that OpenJPA executed a query egainst
the database, but it is not refreshing the changed objects (I have a version
field that change by a db trgger for each update on the underlying db row). 

I am not using a second level cache.

I supose OpenJPA is only checking by ID if the row comming from the db is
already in the cache, but not using the version field to see if it has to be
refresed.

Is any configuration missing?

If not, I would like to make this change, but need directions con classes I
need to implement/change.

Thanks.
-- 
View this message in context: http://n2.nabble.com/Can-not-retrieve-concurrent-updated-data-tp2311276p2311276.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Can not retrieve concurrent updated data

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
  One  possibility is to set IgnoreChanges [1] to true.

  Other possibility is Application A is serving data from QueryCache [1].
  Try disabling it explicitly.
  
  The third (more drastic) is to call em.clear() before querying in
Application A.

[1]
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#openjpa.IgnoreChanges
[2]
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_cache_query

Pinaki

-- 
View this message in context: http://n2.nabble.com/Can-not-retrieve-concurrent-updated-data-tp2311276p2311607.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.