[dojo-contributors] dojo.data: sharing objects between stores

Tom Trenka ttrenka at gmail.com
Fri Aug 31 14:47:43 EDT 2007


This question is mostly for Jared and Brian, but if anyone else knows the
answer, please chime in.
The basic question (think ItemReadFileStore, but I suppose it's relevant for
any store) is this:  can more than one store share a common object (i.e. by
reference, not by value) as an item?

Here's a basic example.  Say I have a set of JSON objects that represent
either a book or a chapter.  Say (for some reason) a chapter can belong to
more than one book.  Say also that not all available chapters should appear
in the book store; i.e. there are two stores, one for books and one for
chapters.

The book store sets up children for chapters, and chapters are added to said
books using the standard _reference technique.

---
One technique (and something I'd think may be a definite n00b mistake making
a transition from a relational model to an object-based one) would be to
create two stores, and simply try to use the same item objects in both by
adding an object reference used in both stores (i.e. chapters).

Another technique might involve cloning the referenced objects in question,
and then creating a query infrastructure to map from one store to another
(say, via the identity API).

Which version would be the recommendation?  I'm asking mainly because I know
that in the process of adding an object as an item in one of these stores,
the Store tends to pre-process and reformat for it's own purposes, and
adding an object already processed in one store might create unpredictable
results when adding to a second store; and I see that that pre-processing
doesn't create a copy of data but simply alters the data passed directly...

In a related (but not necessary) question, has there been any thoughts about
either cross-store queries or the ability to merge two stores into one at
all?

Thanks in advance,
trt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20070831/0533086c/attachment.htm 


More information about the dojo-contributors mailing list