EC's and locks
EC's and locks
- Subject: EC's and locks
- From: Greg Hulands <email@hidden>
- Date: Wed, 6 Oct 2004 14:28:25 +1000
Hi,
In my application I'm using the ER extensions. I have in my application
class an array of EO's that store the preferences in the database.
Whenever I modify a preference I am getting a heap of these messages in
the log:
2004-10-06 14:18:22,054 WARN ShoeBox[13502:50212 2] LockLogger
(ERXEC.java:251) - called method insertedObjects without a lock,
ec=er.extensions.ERXEC@d1cd90
2004-10-06 14:18:22,057 WARN ShoeBox[13502:50212 2] LockLogger
(ERXEC.java:251) - called method insertedObjects without a lock,
ec=er.extensions.ERXEC@d1cd90
2004-10-06 14:18:22,060 WARN ShoeBox[13502:50212 2] LockLogger
(ERXEC.java:251) - called method globalIDForObject without a lock,
ec=er.extensions.ERXEC@d1cd90
The preferences are part of a shared editing context, so I'm not sure
if this is why the messages are coming up.
public void savePreferences() {
EOSharedEditingContext sec =
EOSharedEditingContext.defaultSharedEditingContext();
EOFetchSpecification fs =
EOModelGroup.defaultGroup().fetchSpecificationNamed("All Prefs",
"Preferences");
sec.bindObjectsWithFetchSpecification(fs, "All Prefs");
preferences = EOUtilities.objectsForEntityNamed(sec, "Preferences");
}
public static Preferences localCopyOfPreference(Preferences pref) {
EOEditingContext ec = ERXEC.newEditingContext();
ec.setSharedEditingContext(null);
return (Preferences)EOUtilities.localInstanceOfObject(ec, pref);
}
I get a local copy of a preference before modifying it, then I save it
by doing preference.editingContext().saveChanges(); After I save a
preference savePreferences is called to refetch the new values into the
shared editing context.
I don't know if this is the correct way of implementing things, so I
would be really appreciative if I am doing it wrong for someone to tell
me.
Regards,
Greg
_______________________________________________
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