Is there an easy way to move an entity instance to another, i.e. move a row from one entity to another?

17 views
Skip to first unread message

Mo

unread,
May 10, 2013, 1:03:46 AM5/10/13
to objectify...@googlegroups.com
This may sound weird but not after you understand why I need this. I'm linking youtube videos in my app, as you know sometimes YT videos get removed, so I have to remove them from my app but still have a reference to them.
Is there an easy way remove an entity instance to another, say from YTVideo to DeletedYTVideo? Or, do I have to create a new class with a copy constructor for this?

Jeff Schnitzer

unread,
May 10, 2013, 3:13:29 AM5/10/13
to objectify...@googlegroups.com
New class with copy constructor. It can extend a common base class (or the other entity class) to share structure and behavior.

Jeff


On Thu, May 9, 2013 at 10:03 PM, Mo <m4de...@gmail.com> wrote:
This may sound weird but not after you understand why I need this. I'm linking youtube videos in my app, as you know sometimes YT videos get removed, so I have to remove them from my app but still have a reference to them.
Is there an easy way remove an entity instance to another, say from YTVideo to DeletedYTVideo? Or, do I have to create a new class with a copy constructor for this?

--
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.
 
 

Nicholas Okunew

unread,
May 10, 2013, 3:17:37 AM5/10/13
to objectify...@googlegroups.com
I've also used a boolean or enum flag before for 'deleted', so you can run your queries as normal, including data/stats across both active and deleted results.
You'd need to update your queries to exclude deleted records in the general case.

Huseyn Guliyev

unread,
May 12, 2013, 5:41:46 PM5/12/13
to objectify...@googlegroups.com
Having tried both approaches I would recommend Mo's way of doing it. The problem with having both live and dead entities in one class that you have to have to include index on that boolean field for all composite indices and that becomes performance burden once your data gets big. Especially if you consider that dead data is not queried nowhere as often as new data.

But maybe somebody has a better pattern for deleted or archive data, it would be really interesting to know. Please share your ideas.

Huseyn

On Friday, 10 May 2013 08:17:37 UTC+1, Nick Okunew wrote:
I've also used a boolean or enum flag before for 'deleted', so you can run your queries as normal, including data/stats across both active and deleted results.
You'd need to update your queries to exclude deleted records in the general case.
On 10 May 2013 17:13, Jeff Schnitzer <je...@infohazard.org> wrote:
New class with copy constructor. It can extend a common base class (or the other entity class) to share structure and behavior.

Jeff
On Thu, May 9, 2013 at 10:03 PM, Mo <m4de...@gmail.com> wrote:
This may sound weird but not after you understand why I need this. I'm linking youtube videos in my app, as you know sometimes YT videos get removed, so I have to remove them from my app but still have a reference to them.
Is there an easy way remove an entity instance to another, say from YTVideo to DeletedYTVideo? Or, do I have to create a new class with a copy constructor for this?

--
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-appengine+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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-appengine+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages