Re: IllegalStateException: There is no database snapshot available...
Re: IllegalStateException: There is no database snapshot available...
- Subject: Re: IllegalStateException: There is no database snapshot available...
- From: Chuck Hill <email@hidden>
- Date: Wed, 1 Apr 2009 10:25:32 -0700
Please keep messages on the list.
On Apr 1, 2009, at 2:01 AM, Michael Schmiedgen wrote:
Hi Chuck,
I got frequent, random, hard-to-reproduce Exceptions if I add and
edit some larger amounts of detail objects im my Master-Detail-
DisplayGroup
without saveChanges() in between. That all takes place in a cascaded
EditingContext.
I don't understand what you mean by "cascaded EditingContext". Do
you mean a Parent and Child editing context?
Yes, thats what I mean. For every page that does data manipulation I
use a child editing context.
Why a child instead of a peer? To me, using a child seems to be the
wrong thing to do. That may well be causing this problem if the user
back tracks or a validation exception is thrown.
Are you creating your own editing contexts? If so, how are you
locking and unlocking them? Are you calling undo() or revert() on
the editing context? Is your application running out of memory?
I use ERXEC, so I dont have to care about locking, or should I?
No, not if your properties are set correctly. But you did not say so
I had to ask. :-)
If I do data manipulation / saveChanges, I only do it this way:
In constructor:
ecSession = (ERXEC) session().defaultEditingContext();
ecDetail = (ERXEC) ERXEC.newEditingContext(ecSession);
I'd just make that
ecDetail = (ERXEC) ERXEC.newEditingContext();
On save:
synchronized (LOCK) {
ecDetail.saveChanges();
ecSession.saveChanges();
}
No catch for save failures?
This is implemented in an abstract class. A page (top level component)
inherits this if object editing is needed.
In the case the exception occurs there is a list component in the page
that uses undo grouping.
Undo sounds dangerous. That could easily cause this if misused.
revert() is never called. And I got no memory problems so far.
Thanks,
Michael
Chuck
--
Michael Schmiedgen, BSc
Takwa GmbH
Bodelschwinghstr. 25
99096 Erfurt GERMANY
Tel +49 361 6534096
Fax +49 361 6534097
Mail email@hidden
Web http://www.takwa.de/
Geschaeftsfuehrung: Ingo Buchholz
HRB 12964, Amtsgericht Erfurt
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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