Found it, and I don't like it one bit.  The inserts weren't the
problem, it was the async task that was deleting the serialized Set.
The fix was to touch that collection before persisting.  I don't know
why I have to do this - if I missed some documentation somewhere,
that's one thing, but I'm kinda nervous now about updating entities,
not knowing if I'll lose stuff.

// original code that deleted my serialized Set:
tx.begin();
Product p = persistenceManager.getObjectById(Product.class,
myProductKey);
p.incrementCounter();
persistenceManager.makePersistent(p);
tx.commit();

// new code that doesn't delete the serialized set:
tx.begin();
Product p = persistenceManager.getObjectById(Product.class,
myProductKey);
p.incrementCounter();
Set<Foo> foo = p.getFoo(); // this is the serialized Set
persistenceManager.makePersistent(p);
tx.commit();

On Mar 20, 11:31 pm, Blake <blakecaldw...@gmail.com> wrote:
> Nevermind everyone.  I'm sure this is going to end up being something
> stupid.
>
> On Mar 20, 11:26 pm, Blake <blakecaldw...@gmail.com> wrote:
>
>
>
> > I just narrowed it down a bit further - in the second insert, I'm
> > kicking off a Task to update the entity in the first insert.  If I
> > don't queue up that task, everything's fine.  I thought that would
> > have been fine, since the first insert's transaction has already
> > closed.  Here's the updated flow:
>
> > // get persistence manager
>
> > // open trans
> > // create EntityOne obj, set the serialized property
> > // insert EntityOne obj
> > // commit trans
>
> > // open trans
> > // create and insert EntityTwo obj
> > // kick off task that updates the EntityOne obj above
> > // commit trans
>
> > // close persistence manager
>
> > On Mar 20, 11:16 pm, Blake <blakecaldw...@gmail.com> wrote:
>
> > > I'm trying to insert two entities from different classes in the same
> > > request, each inside their own transaction.
>
> > > Everything works just fine, except that the serialized Set that exist
> > > in the first insert doesn't persist.  I've verified that if I remove
> > > the second insert, the Set does persist, so it's not a problem with my
> > > classes not being serializable.  Also, a later request is able to
> > > write to the serialized Set.
>
> > > Any ideas?
>
> > > Here's my serialized map definition:
> > > @Persistent(serialized = "true")
> > > private Set<MySerializable> mySerializables;
>
> > > And here's how I'm doing the two inserts:
>
> > > // get persistence manager
>
> > > // open trans
> > > // create EntityOne obj, set the serialized property
> > > // insert EntityOne obj
> > > // commit trans
>
> > > // open trans
> > > // create and insert EntityTwo obj
> > > // commit trans
>
> > > // close persistence manager

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to