Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Long cursored query and concurrent updates leads to out-of-date reads from long query
Long cursored query and concurrent updates leads to out-of-date reads from long query [message #1636300] Thu, 26 February 2015 05:59
Vjacheslav Borisov is currently offline Vjacheslav BorisovFriend
Messages: 6
Registered: March 2014
Junior Member
Long cursored query and concurrent updates leads to out-of-date reads from long query

I have Client:Segment many-to-many entity relation

I have long running cursored query
Query query = em.createQuery("SELECT c FROM Client c WHERE c.clientUUID between :clientUUIDFrom and :clientUUIDTill ORDER BY c.clientUUID");
query.setParameter("clientUUIDFrom", clientUUIDFrom);
query.setParameter("clientUUIDTill", clientUUIDTo);
query.setHint(QueryHints.CURSOR, HintValues.TRUE);
query.setHint(QueryHints.QUERY_RESULTS_CACHE, HintValues.FALSE);
query.setHint(QueryHints.LEFT_FETCH,"c.segments");

One thread reads all records and updates many-to-many relation.
This is working when there is no concurrent work on same entity

But when there is short concurrent update in other thread, which alters many-to-many relation of entity, and later same entity being read from long query, it reads it in old state.
And update of this entity leads to mysql exception

Duplicate entry '693502093-10' for key 'PRIMARY'

Becouse relation 693502093-10 aready persisted in parallel thread before.
How to correctly lock / invalidate results of long cursored query in case of concurrent updates?

[Updated on: Fri, 27 February 2015 04:58]

Report message to a moderator

Previous Topic:SQL generation fails - Resource '/<project-root>/createDDL.sql' does not exist.
Next Topic:EclipseLink bugs: where/how to report?
Goto Forum:
  


Current Time: Sat Apr 27 03:16:22 GMT 2024

Powered by FUDForum. Page generated in 0.04174 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top