You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to objectify...@googlegroups.com
Hi all, I newbie with objectify ( before i have used JPA with datanucleous in gae projects ...)
What is better performance to save relationated objects with objectify?.
Option1 @Entity public class Entity1{ private Entity2 ent2; }
@Embed public class Entity2{ private String prop; } On the one hand @Embed mechanism write all embed data into Entity1 and can be accesible by query to Entity1 entity with syntax ->" ent2.prop= "value" This mechanism only need one operation to write entire relation objects. and need only one operation to query In some test I found that is slower than save child entity with <Ref>.... My test looks like this:
ofy().save().entity(mainEntity).now(); ofy().load().type(mainEntity.class).list() ; --> Some times this query get size 0 (Maybe datastore is not prepared for quer so quickly....but i use .now() on save....) ;-(
Option2 On the other hand I can save 2 entities, the "relatedEntity" and the Ref<RelatedEntity> in main entity this cost 2 operations to write and to query for, but in my test always works fine.
What do you think is the better way to store relations?
Thanks in advance guys!!
Jeff Schnitzer
unread,
Feb 14, 2014, 11:33:07 AM2/14/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to objectify...@googlegroups.com
ofy().load().type(mainEntity.class).list();
is an eventually consistent query. As would your other query unless
you specify an ancestor(). Note that you can specify an ancestor() in
the above query, in which case you will get back the single entity.
See this:
Most of the time in this case you are better off embedding the data...
but it depends on your query profile and the shape of the data.
Jeff
> --
> You received this message because you are subscribed to the Google Groups
> "objectify-appengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to objectify-appen...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.