SOLVED The problem boiled down to serialized fields just being tricky. It looks like you can be on the safe side to use this tip when updating an entity with serializable fields:
JDOHelper.makeDirty(obj, fieldName) via: http://groups.google.com/group/google-appengine-java/browse_thread/thread/747ceed8396c0ed8/10ccdd1a0c376825 On Mar 20, 11:08 pm, Blake <[email protected]> wrote: > Thanks Eli - I'm going to re-post this as a new request, given the > narrowed-down scope > > On Mar 20, 10:48 pm, Blake <[email protected]> wrote: > > > > > I found that this problem only happens when I'm inserting another > > entity from a different entity group in the same request. I know that > > you can only insert from one entity group in a transaction, but can't > > I insert into different entity groups in a single connection, but > > without an explicit transaction? > > > On Mar 20, 8:37 pm, Blake <[email protected]> wrote: > > > > Okay, I'm replying to my own post here, because I've spent hours on > > > this, making no progress. I've even set the serialized object into my > > > entity, saved it, printed it out, evicted all entities from the > > > persistence manager, found the entity again, then printed out the > > > serialized object in that same request, and it all looks good. > > > > When I come back to the server in a second request to grab that > > > serialized object, it's gone. Only when I set it again in another > > > transaction does it stick. > > > > Any ideas? Is there some weird behavior of saving serialized objects > > > into a field that I might not be aware of? > > > > Why would this work on update, but not insert? > > > > On Mar 19, 1:32 am, Blake <[email protected]> wrote: > > > > > I thought this was working before, so I'm not sure if this is a PEPCAK > > > > problem... > > > > > I'm inserting an entity with aserializedcollection of > > > > otherserializedobjects. This stores correctly on updates, but when I > > > > set > > > > theserializedcollection on insert, it forgets the collection. Any > > > > ideas? Would you expect insert and update to handle theserialized > > > > collection of objects differently? > > > > > Thanks! > > > > > Here's how I'm doing it: > > > > > public class Foo{ > > > > ... > > > > > @Persistent(serialized="true") > > > > private Set<SomeSerializedObject> myObj; > > > > > ... > > > > > } > > > > > Foo f = new Foo(); > > > > f.setSomeSerializedObject(new SomeSerializedObject("foo bar")); > > > > Transaction tx = pm.currentTransaction(); > > > > try > > > > { > > > > tx.begin(); > > > > pm.makePersistent(f); > > > > tx.commit();} finally { > > > > > if(tx.isActive()) > > > > { > > > > tx.rollback(); > > > > } > > > > > } -- You received this message because you are subscribed to the Google Groups "Google App Engine" 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?hl=en.
