I am trying to remove an object from the datastore without and I want to know if my approach can be made to work with transactions.
I have a collection of entities that all participate in owned relationships. However, one entity has an unowned collection of keys that refer to another entity. Here is the basic structure: EmailList owns DirectContacts EmailList owns IndirectContactLists IndirectContactList owns IndirectContacts DirectContact has an unowned collection of keys of IndirectContacts (because an entity can only have one parent) If I grab an IndirectContactList from the datastore and get the owning EmailList and then proceed to traverse through the EmailList's DirectContacts and remove the key of the IndirectContacts can I do this within the context of a transaction? Here is a code snippet without transactions: //used to interact with the datastore //create the entity manager EntityManager em = EMF.get().createEntityManager(); try { //get the indirect contact list IndirectContactList icl = em.find(IndirectContactList.class, keyOfIndirectContactList); if(icl != null) { //get the email list from the icl EmailList eml = icl.getOwningEmailList(); //get the direct contacts for the email list for(DirectContactEmail dce : eml.getDirectContactEmails()) { //is this transaction safe??? if not, would grabbing the email //list first make it safe? //now remove the reference to the icl dce.getKeysOfIndirectContactEmails().remove(keyOfIndirectContactList); } //remove the indirect contact list and all the owned indirect contact emails em.remove(icl); } else { throw new IndirectContactListDoesNotExistException(); } } finally { em.close(); } Can I add transaction code and expect that removing the unowned keys will succeed/fail with the removal of the indirect contact list? -- 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-j...@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.