Hi,

Since they all belong to the same entity group, you have to recreate
also the other entities as well.

I would personally handle that per entity group, i.e launch a task
(for parallelism)  per entity group then recreate the parent of the
entity group in the new namespace, then recreate all the other
entities within this group in this new namespace.

regards

didier

On Oct 30, 9:46 am, aswath satrasala <[email protected]>
wrote:
> Good point.  They belong to the same entity group.  The more complete
> Objectify class is shown.
> public class Payment implements IsSerializable {
>     @Id
>     private Long id;
>     @Parent Key<Party> parentPartyKey;
>     private String comments;
>     private double amount;
>
> }
>
> public class Invoice IsSerializable {
>     @Id Long id;
>     @Parent Key<Party> parentPartyKey;
>     InvoiceType invoiceType;
>     Status status;
>     private double amount;
>
> }
>
> In the application,there are situations, where I update the Payment and
> Invoice in a transaction.
>
> So, how can this be done in mapreduce.
>
> -Aswath
>
> On Sat, Oct 30, 2010 at 12:26 PM, Didier Durand 
> <[email protected]>wrote:
>
> > Hi,
>
> > Question from side: do Payment & Invoice belong to the same entity
> > group as Party ? I ask this because of the transactional implications
> > it will have when you modify keys in Payments & Invoices.
>
> > regards
> > didier
>
> > On Oct 30, 5:04 am, aswath satrasala <[email protected]>
> > wrote:
> > > Hi,
> > > Further, on this... which leads to how changing of the namespace can be
> > done
> > > using mapreduce.
>
> > > If I recreate entities, then if the keys are stored as references in
> > other
> > > entities also needs to be recreated.
> > > Ex.
> > > class Party {
> > >   @Long id
> > >   Key<Tenant> tenantKey;  // partitioning/filtering
> > >   String fname
>
> > > }
>
> > > I have several other entitities dependent on the Party Key.
> > > class Invoice {
> > > �...@long id
> > >  Key<party> partyKey
> > >  ...}
>
> > > class Payment {
> > > �...@long id
> > >  Key<Party> partyKey
>
> > > }
>
> > > All invoices/Payments has to be re-created.
>
> > > So, how can this be done using mapreduce jobs.  One option is
> > > - Using mapreduce, all the Party entities are recreated.  The originalkey
> > > and the newkey is stored in a different mapping table, something like
> > this
> > > and operates in the empty namespace.
> > > class MigrationMappingKeys {
> > > @Long id;
> > > Key<Party> oldKey
> > > Key<Party> newKey
>
> > > }
>
> > > Then, I run the mapreduce job on the Invoice and Payment, and recreate
> > based
> > > on the above class.
>
> > > Any other options...?
> > > -Aswath
>
> > > On Thu, Oct 28, 2010 at 3:25 PM, Didier Durand <[email protected]
> > >wrote:
>
> > > > Hi,
>
> > > >http://code.google.com/appengine/docs/java/javadoc/com/google/appengi.
> > ..
> > > > says
>
> > > > "When a namespace aware class (e.g., Key, Query and MemcacheService)
> > > > is constructed, it determines which namespace will be used by calling
> > > > get() if it is otherwise unspecified. If get() returns null, the
> > > > current namespace is unset and these APIs will use the empty ("")
> > > > namespace in its place. "
>
> > > > So, I would guess that you have to recreate / copy your entities after
> > > > having set namespace via NameSpaceManager.set() if you want to move
> > > > them into a new namespace
>
> > > > regards
> > > > didier
>
> > > > On Oct 28, 11:34 am, aswath satrasala <[email protected]>
> > > > wrote:
> > > > > Hello,
> > > > > I have an multi-tenant app-id, and I have designed on partitioning
> > the
> > > > > entities based on  url parameters.  I am not using the namespace yet.
>
> > > > > For example,
>
> > > > > Tenant {
> > > > > @Id name+email;
>
> > > > > }
>
> > > > > class Party {
> > > > >   @Long id
> > > > >   Key<Tenant> tenantKey;  // partitioning/filtering
> > > > >   String fname
>
> > > > > }
>
> > > > > Now, I am planning to use the NamespaceManager for the Party
> > entities.  I
> > > > > want to use the mapreduce and apply the namespace on the existing
> > Party
> > > > > entities.
> > > > > Can a namespace be changed from empty to certain value on the
> > existing
> > > > > entity.
>
> > > > > -Aswathhttp://vs-accounting.appspot.com
>
> > > > --
> > > > 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%[email protected]>
> > <google-appengine-java%[email protected]<google-appengine-java%[email protected]>
>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/google-appengine-java?hl=en.
>
> > --
> > 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%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.

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