hmmmm, I think you're right.

Any ideas on how to optimize the datastore query for a sub branch of
the tree?

With this approach I either need to

a) bring in all items in the app (possibly filtered by owner) across
the RPC boundary and then structure them in the GWT client
b) continue to look for child nodes in the tree via parentkey, until
no children remain (will require a query on each node for the
children).

I was hoping to avoid a long, drawn out query...

RH

On May 4, 2:37 am, Ravi Sharma <ping2r...@gmail.com> wrote:
> I will advise you to use unowned relation in this scnerio. Instead of
> Directory entity having childrens...i will put parent information in the
> Directory entity.. this way you can make sure one Directiry can have
> millions of Child directory...as you will not max out the maximum entity
> size.
>
> class Directory {
>        public String name;
>        public ArrayList<Directory> children = new
> ArrayList<Directory>();//Delete this
>        public Key parentKey;
>
>        // could have any other properties or attributes here as well
>        Directory(String n){
>       name = n;
>
>    public void Display() {
>                System.out.println(" name: " + name);
>                for(Directory d : children)
>                        Display();
>        }
>
> }
>
> You can write one GWT RPC function like this
> Directory[] getMyChildren(String parentKeyParam){
> //On the server you can query like this
> Select * from Directory where parentKey = parentKeyParam
> and return it back to GWT.
>
>
>
>
>
>
>
> }
> On Wed, May 4, 2011 at 3:47 AM, RH <richkh...@gmail.com> wrote:
> > here would be an example using the heap:
>
> > class Directory {
> >        public String name;
> >        public ArrayList<Directory> children = new ArrayList<Directory>();
>
> >        // could have any other properties or attributes here as well
> >        Directory(String n){
> >       name = n;
>
> >    public void Display() {
> >                System.out.println(" name: " + name);
> >                for(Directory d : children)
> >                        Display();
> >        }
> > }
>
> > You should be able to add or remove any object in the tree:
>
> > ...
> >   directoryObject.children.Add(new Directory("new child"));
> > ...
>
> > and you can display the node and any child nodes:
>
> > ...
>
> >     directoryObject.Display();
>
> > I want to use the GAE datastore to persist these POJOs (easy enough in
> > JDO) but also maintain their structural relationship to each other
> > (hard, at least that I can see) - That is, I am trying to persist the
> > object instances *and* their relations to each other.
>
> > RH
>
> > On May 2, 11:37 am, Todd Vierling <t...@duh.org> wrote:
> > > On Saturday, April 30, 2011 9:06:45 PM UTC-4, RH wrote:
>
> > > > I'm looking for a simple way to persist a set of dynamic Composite
> > > > Design Pattern objects (as described in Design Patterns by Gamma,
> > > > Helm, Johnson, and Vlissides) with either Google's native datastore,
> > > > JDO, or JPA, as well as send to and from the client via RPC.
>
> > > Design patterns mean pretty much zero in real-world discussions, so
> > example
> > > code would be a lot more helpful. (Or in other words, "what does the
> > class
> > > you're trying to persist look like?")
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-appengine@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to