Re: Database access
Re: Database access
- Subject: Re: Database access
- From: André Rothe <email@hidden>
- Date: Fri, 27 Oct 2017 13:57:52 +0200
Hi Chuck,
The problem (1) was a loop which has repeated some code. So the value
changes correctly from 0 to 100, but n times...
setRefreshesRefetchedObjects() is the solution for problem (2), I also
can remove ec.invalidateObjectsWithGlobalIDs()
Thanks a lot!
André
Am 2017-10-26 23:33, schrieb Chuck Hill:
Hi André,
I think there must be more to this than you have written here. The
only way that I can think of that (1) could happen is if you have
multiple threads (maybe in multiple application instances) that are
all writing to the same row in the database. If saveChanges() does
not throw, the change has already been written to the database and
committed.
For (2) try re-fetching the EO(s) using a fetch spec with
setRefreshesRefetchedObjects(true). If that is not showing the
correct numbers, then I have no idea what is happening.
Chuck
On 2017-10-26, 2:08 PM, "Webobjects-dev on behalf of André Rothe"
<webobjects-dev-bounces+chill=email@hidden on behalf
of email@hidden> wrote:
Hi,
some more questions:
1. I have a thread, which runs a long time. To store the current
status,
I use an EO, which has an attribute called "completed". This
attribute I
set to 10% or 50% and so on. After a value change, I call
ec.saveChanges(). But it seems, that the values are not visible in
the
database in the correct chronologically order. Sometimes I see 90,
than
I see 60 again. How can I force the write access to the database
backend
for the specific EO?
2. The attribute above I try to read in another EdititingContext.
But I
always see 0% (the start value) and after the thread finishes, I
will
see 100%. But it is not possible to get other values as long as the
second thread runs. I have tried
ec.invalidateObjectsWithGlobalIDs(ids),
but it did not work as expected, "completed" returns always 0%. How
I
can force the EditingContext to read the current value from the
database?
Thank you
Andre
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden