I have members O2M clubmemberships in my app and I have a workflow where members can edit clubmemberships on their account. The clubmembership object is lazy loaded and proxied as an array. The flow looks like:
* member.getClubMembership(clubid) * set the values * save it Obviously sometimes that returns a persisted object and other times it returns an unpersisted object when adding a new clubmembership. To avoid polluting the cache, the code today looks like: mem = member.clone(); clubmem = mem.getClubMembership(clubid); clubmem.set*(x,y,z); if (not clubmem.validate()) // report errors to user else transfer.save(clubmem); I use the clone so that, if it doesn't pass validation, it doesn't leave the original member in the cache with a broken-but-attached clubmembership. I have been experiencing weird behavior where saving the clubmembership does not eliminate the clone'd member and until the cache is flushed (discardAll()), running transfer.get(member).getClubMembership(clubid) continues to show me old values. E.g., the parentmember is not discarded/synchronized with the cache when I save the clubmembership. Now, I figured out via a thread from James Allen how to partially correct this by introducing a transfer.discard(member) before the transfer.save(clubmembership). However, it hasn't quite fixed it all the way so I suspect I may not be addressing the root issue. This manifests itself where clubmembership object is M2O on an attendee object. Basically a clubmember can be an attendee for 1-n events so the attendee object has two M2Os: clubmembership and event along with some other properties. During the registration process, this attendee object is put into the session scope. Let's call it session.attendee. The issue I'm having is that even after adding the discard() before saving the clubmembership, the attendee object in the session is still returning the pre-update version of the clubmembership when I call attendee.getClubMembership(). Here it is in psuedo code: // start with a known memberid transfer.get(member, id).getClubMembership(clubid).getMemberID() -> 1234 // load the registration form, which creates session.attendee: session.attendee.getClubMembership().getMemberID() -> 1234 // we want to change the member id, so we edit it member = transfer.get(member, id); mem = member.clone(); clubmem = mem.getClubMembership(clubid); clubmem.setMemberID(6000); transfer.discard(mem); transfer.save(clubmem); // now compare the objects in the cache and the session: transfer.get(member, id).getClubMembership(clubid).getMemberID() -> 6000 session.attendee.getClubMembership().getMemberID() -> 1234 session.attendee.getClubMembership().equalsTransfer(transfer.get(member, id).getClubMembership(clubid)) -> TRUE ???? Am I wrong in thinking that an attendee object in the session will not retrieve its clubmembership from the transfer cache? The attendee object in the session is NOT a clone(). What should I change to get this to work right so that the session.attendee object returns the updated clubmembership? I can tolerate a down and dirty fix for now and a clean fix later. :) Brian -- Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer Try out the new Transfer ORM Custom Google Search: http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8 You received this message because you are subscribed to the Google Groups "transfer-dev" group. To post to this group, send email to transfer-dev@googlegroups.com To unsubscribe from this group, send email to transfer-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en