Thanks you for that tip!

Do I understand you that I should only call makePersistent() if the entity 
does Not exist already?
And that if I want an update to fail when the entity does not exist I should 
do nothing beyond Transaction.commit()?

What I mean is:


        Transaction tx = pm.currentTransaction();
        try{
            tx.begin();
            persistme = pm.getObjectById( Thingy.class, sameKey );
            if( persistme != null )  persistme.changeSomeValue(); // 
persistme could have been deleted by another thread even though it is not 
null
            // Note: I do NOT call makePersistent();
            tx.commit(); //Question: Is it true that persistme is updated 
only if it exists otherwise nothing happens? (or maybe an exception)?
        }
        finally{
            if( tx.isActive() ){
                tx.rollback();
            }
        }
    pm.close(); // Question: I know that this can recreate a previously 
deleted entity. Will it do so now after I have called tx.commit(); above?



Or do I misunderstand: Is there a call like makePersistent() that will only 
update the entity if it esits but fail if it does not?

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