If you choose to model the attribute as an entity, you would use an unowned
relationship since owned entities can only have a single parent. If
attributes are simple strings, you can just use a multi-valued (List)
property of strings. Some cars will have the same string attributes, but
this shouldn't cause a huge effect on performance or cost, assuming you
don't have too many attributes per car.
- Jason

On Tue, Aug 25, 2009 at 8:25 PM, Iain <iain.robe...@gmail.com> wrote:

>
> Do you really need one instance of the attribute? If so I suggest
> unowned, and use transactions to avoid duplicates. Read this artical:
> http://code.google.com/appengine/docs/java/datastore/transactions.html
> If performance is not a concern, use a one-many
> http://code.google.com/appengine/docs/java/datastore/relationships.html
>
> If you do not care about one instance of the attrbite, use a
> collection. This will also perform better as you only load one entity.
>
> http://code.google.com/appengine/docs/java/datastore/dataclasses.html#Collections
>
>
>
>
>
> On Aug 26, 12:23 pm, mar_novice <mariocape1...@gmail.com> wrote:
> > Situation..
> > I have two class, Car and Attribute
> > A car can have zero or more attributes and Cars can have the same
> > attribute.
> >
> > Now for example
> >  I created an instance of a car names X and has an attribute of Big.
> > ------------------                   ---------------------------------
> > |  Car          |                  |           Attribute          |
> > -----------------                   ----------------------------------
> > |       X        |                  |             Big               |
> > |                 |                  |
> > |
> >
> > now what if I created another instance of a car named Y and it has
> > also an attribute of Big and Fast..
> >
> > ------------------                   ---------------------------------
> > |  Car          |                  |           Attribute          |
> > -----------------                   ----------------------------------
> > |       X        |                  |             Big               |
> > |      Y        |                  |              Big              |
> > |                |                  |              Fast             |
> >
> > What is the proper approach so that the Big instance of attribute will
> > not be duplicated? And should I use one to many relationship? Also it
> > is owned or unowned?
> >
> > Thanks in advance for helping out..
> >
> > -mar_novice
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to