Re: Multi-User using Core Data?
Re: Multi-User using Core Data?
- Subject: Re: Multi-User using Core Data?
- From: Nicko van Someren <email@hidden>
- Date: Fri, 10 Jun 2005 12:24:05 +0100
On 10 Jun 2005, at 10:23, mmalcolm crawford wrote:
On Jun 10, 2005, at 1:55 AM, Nicko van Someren wrote:
Apple obviously made a conscious decision not to support remote
databases with Core Data - they already had an architecture in
place to do it (EOF), so it clearly could have been done had they
really wanted to. I have no reason if their reason not to
include that support was technical, political, or what, but that
being said, there are a couple of options give use a single data
store for applications on separate machines.
I think that the main reason for not doing this is that CoreData
is essentially free but you have to pay for the Enterprise Objects
framework, so they felt it was necessary to "cripple" the freeware
to a specification that is useful for desktop applications but
left the corporates with deep pockets needing to buy EOF.
Core Data is not a "crippled" EOF. Its goal, and how it contrasts
with EOF, is made clear in the FAQ:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CoreData/Articles/cdFAQ.html#//apple_ref/doc/uid/TP40001802-244739>
I appreciate that one is not a crippled copy of the other. What I
was meaning is that the SQL database functionality of one is a subset
of the other, e.g. a crippled specification. CoreData adds a bunch
of extra features too; fetched properties, local stores and store
aggregation being key, but the remote, shared database server support
is missing.
Also note: WebObjects is bundled for free with the Developer Tools...
Really? WO is available as a download for paid-up commercial
developers through ADC Select and Premier membership but I don't see
any sign of it in the free developer tools.
1) You could make the SQLite data file location a preference
value, and set it to a network drive location.
This is fine until you have two applications accessing the same
data at the same time at which point the memory cache and the file
will get woefully out of sync and "bad things" will happen.
This ("bad things" will happen) is not the case. Just like EOF,
Core Data is designed to properly detect and deal with situations
in which the persistent store is modified by another application,
and there are well-specified patterns to follow if this occurs.
Really? On the page of the link you gave above, under the heading
Change Management it says:
"There is an important behavioral difference between EOF and
Core Data with respect to change propagation. In Core Data, peer
managed object contexts are not "kept in sync" in the same was as are
editing contexts in EOF. Given two managed object contexts connected
to the same persistent store coordinator, and with the "same" managed
object in both contexts, if you modify one of the managed objects
then save, the other is not re-faulted (changes are not propagated
from one context to another). If you modify then save the other
managed object, then (at least if you use the default merge policy)
you will get an optimistic locking failure."
Clearly then there is no change propagation even if we are talking
through the same Persistent Store Coordinator, let alone if we are
accessing the same file from two different applications on two
different machines over a network. If we were using two application
on the same machine perhaps we could watch the database files (using
something like Uli's UKKQueue http://www.zathras.de/angelweb/
sourcecode.htm#UKKQueue ) and call refreshObject:mergeChanges: on
anything we care about, but as far as I know file change notification
does not work reliable over network mounts.
The section in the Core Data Programming Guide on Change Management
<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/
Articles/cdChangeManagement.html> makes no mention whatsoever
regarding multiple applications accessing the same source (on the
same machine or different ones), though it makes repeated remarks
about the same application accessing the same data through multiple
Managed Object Contexts (which all talk to the same Persistent Store
Coordinator).
It would be very useful if Apple could make a clear statement (a
Technical Note perhaps) about how to have multiple applications
accessing the same data store through Core Data, and in particular
how to do this with the applications on different machines. If it is
genuinely the case that Apple did not deliberately dumb down the
specification of Core Data then it would be useful to know how to
achieve the same effect as WO/EOF through Core Data.
Nicko
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden