you may find this thread useful:

http://groups.google.com/group/google-appengine-java/browse_thread/thread/4298b7f54f1b58db/ddfabdb64110effc?q=


On Jun 14, 12:57 am, Alfred Fuller <[email protected]>
wrote:
> http://www.youtube.com/watch?v=AgaL6NGpkB8is a good resource and I believe
> explicitly covers this scenario.
>
>
>
> On Sun, Jun 13, 2010 at 10:41 PM, Ian Lewis <[email protected]> wrote:
> > Ben,
>
> > With non-relational databases like appengine's datastore you need to
> > create data based on the way you will query it rather than the way you
> > want to store it.
>
> > In your case it looks like you would need to create a model to store
> > the data you want to query (essentially an index that you manage). A
> > model something like the following might work.
>
> > PeopleOwnItemsIndex {
> >    person (reference to the person owning the items/people)
> >    owner (reference to the person owning the item)
> >    item (reference to the item owned)
> > }
>
> > You'll be querying on the person field so the query will need to go in
> > your datastore-indexes.xml or index.yaml
>
> > When you change owners or add items you'll need to update the data for
> > this model. If you want to consolidate models you could also get only
> > your own items by creating an index on person+owner and query it with
> > person = me, owner = me. That would be instead of using PersonOwnItem,
> > but the difference would be you would have a record for each person
> > that can see the item rather than only one for the person owning the
> > item.
>
> > Ian
>
> > On Sun, Jun 13, 2010 at 4:10 AM, Ben Woodhead <[email protected]>
> > wrote:
> > > Hello Everybody,
>
> > > I am very comfortable with SQL and relational databases and I am
> > > trying to wrap my head around GAE. Below is an example of how I would
> > > tackle my problem in SQL and it would be really great if someone could
> > > give me some hints on how to accomplish something similar in GAE. Its
> > > basically a hierarchy of ownership.
>
> > > The 2 base tables:
>
> > > table People {
> > >       int personId;
> > >       string name;
> > > }
>
> > > table items {
> > >    int itemId;
> > >    string itemName;
> > > }
>
> > > The 2 relational tables:
> > > table PeopleOwnPeople {
> > >    int ownersId;
> > >    int personId;
> > > }
>
> > > table PeopleOwnItems {
> > >    int personId;
> > >    int itemId;
> > > }
>
> > > So now that we have a basic structure I can start to explain the idea
> > > or problem. I want to be able to search for all items owned by me and
> > > the people i own:
>
> > > select items.* from Items, PeopleOwnPeople, PeopleOwnItems where
> > > (PeopleOwnPeople.ownersId=234 and
> > > PeopleOwnPeople.personId=PeopleownItems.personId) or
> > > PeopleOwnItems.personId = 234 ;
>
> > > I am looking to use GWT as my frontend to this project so I am likely
> > > going to be using Java for the backend but that isn't set in stone
> > > yet.
>
> > > Thanks any and all help.
> > > Ben
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > [email protected]<google-appengine%2Bunsubscrib 
> > [email protected]>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.
>
> > --
> > =======================================
> > 株式会社ビープラウド  イアン・ルイス
> > 〒150-0021
> > 東京都渋谷区恵比寿西2-3-2 NSビル6階
> > email: [email protected]
> > TEL:03-6416-9836
> > FAX:03-6416-9837
> >http://www.beproud.jp/
> > =======================================
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine%2Bunsubscrib 
> > [email protected]>
> > .
> > 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to