I'm new to jdo and GAE so I probably have some simple misunderstanding that 
someone can quickly solve.

I have one servlet "A" that modifies an entity and another servlet "B" that 
deletes the same entity. The problem is that when both are called at the 
same time, the entity is being recreated after it was deleted.

What I mean is:

servlet A does

        delme = pm.getObjectById( Thingy.class, sameKey );
        Transaction tx = pm.currentTransaction();
        try{
            tx.begin();
            pm.deletePersistent( delme );
            tx.commit();
        }
        finally{
            if( tx.isActive() ){
                tx.rollback();
            }
        }


servlet B does

        persistme = pm.getObjectById( Thingy.class, sameKey );
        persistme.changeSomeValue();

        Transaction tx = pm.currentTransaction();
        try{
            tx.begin();
            pm.makePersistent( persistme );
            tx.commit();
        }
        finally{
            if( tx.isActive() ){
                tx.rollback();
            }
        }


I would like servlet B to fail if the entity was deleted by Servlet A. 
Instead, Servlet B just recreates the deleted entity. Anyone know what I 
need to do here?

(the actual code is a little more complex than this eg the entity I am 
modifying is actually a dependent child in an list of another entity)

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