I watched the video and im still having some trouble,  A lot of his
examples where in python while im using JAVA/JPA, also i may be having
trouble pulling myself away from the idea of rational dbs

It may be the way im structuring my Entities.
my classes are below, It currently doesn't work in app engine but its
generally what im going for, how should i be setting it up.  I want to
be able to perform queries on friends list as well, like sorting,
etc...

@Entity
public class User {
        @Id
        @GeneratedValue(strategy=GenerationType.IDENTITY)
        private Long id;
        ...Other Properties...

        @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
        private Person person = new Person();

...getters and setters...
}

@Entity
public class Person {
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private Key key;
        private String name;

        @OneToMany(cascade = CascadeType.ALL)
        private List<Person> friends = new ArrayList<Person>();

...getters and setters...
}

On Jul 19, 11:38 am, Nacho Coloma <[email protected]> wrote:
> My 2 cents: if all your users are of type Person and it's a root
> entity, you can also save some space by storing Key ids instead of Key
> instances (you save the redundant type name etc).
>
> On Jul 19, 5:53 am, "Ikai L (Google)" <[email protected]> wrote:
>
> > The best practice is probably to create list properties with Keys
> > representing friend IDs. This is a good video to watch:
>
> >http://www.youtube.com/watch?v=AgaL6NGpkB8
>
> > On Fri, Jul 16, 2010 at 8:03 AM, dmetri333 <[email protected]> wrote:
> > > Imrelativelynew too GAE and the Datastore, and i had a question on
> > > the best way to setup some entities.
>
> > > I have created a entity called 'Person' and this person has a list of
> > > friends in the system that are also of type 'Person'.  In SQL i would
> > > have created a simple linker/relationship table with 2 fields
> > > (person_id, friend_id), both referring to the same id from the
> > > 'Person' table.
>
> > > I was wondering what the best practice for doing this with GAE and
> > > bigtable.
>
> > > demetri
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google App Engine for Java" group.
> > > To post to this group, send email to
> > > [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-appengine-java%2B
> > >  [email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine-java?hl=en.
>
> > --
> > Ikai Lan
> > Developer Programs Engineer, Google App Engine
> > Blog:http://googleappengine.blogspot.com
> > Twitter:http://twitter.com/app_engine
> > Reddit:http://www.reddit.com/r/appengine

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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-java?hl=en.

Reply via email to