[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-29 Thread datanucleus
> A question about the "ancient version of DataNucleus" you mention: > Is there a more up-to-date approach I should be using within GEA? Could you > point me toward the resource for that if any? Nothing you can do (apart from getting the code for the GAE/J DataNucleus plugin and updating it); it's

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-29 Thread Zeno
This sounds like the answer. Thanks! Specifically if a JDOOptimisticVerificationException is guaranteed when updating a deleted entity. So it looks like my confusion stemmed from misunderstanding makePersistent() and believing it was need for updates. The tip about putting obj = getObjectById

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-28 Thread datanucleus
Optimistic transactions sets a version on the object. If something is deleted in another thread then JDOOptimisticVerificationException is thrown when you update. THat's the whole point of optimistic txns (whether in JDO, JPA or anywhere). And no, after reading an object in via getObjectById the o

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-27 Thread Brandon Donnelson
I've been thinking about your deal. Since the changes are happening concurrently, you could either sync the servlet threads up and talk across the servlets, which I have no experience and haven't tried servlet concurrency or keep track of the threads through a jdo class. So here is what I would

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-27 Thread Brandon Donnelson
He has two servlets concurrently working on the same object, what would you suggest? Brandon -- 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 google-appengine-java@googlegroups.com. To unsubscr

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-27 Thread Brandon Donnelson
I think this is a good question for Ikai, hes the guru that might be able to give you some light to your path. I see the dilemma, but I'm not sure which road :). Brandon -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-27 Thread Zeno
If I check getObjectById() just before makePersistent(), another thread could still delete it between the two calls couldn't it? Uses_for_Transactions Is exactly the thing. _Except_ not fo

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-27 Thread Erwin Streur
Brandon, I don't think your last answer is helping him. Because in this case he needs the transaction for the isolation and he is on the right track already. By querying for the entity by ID "sameKey" in Servlet B the transaction is pinned to that entity group and therefore the transaction is effe

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-27 Thread Brandon Donnelson
Hmm, let see if I can convert my thought into words :). To persist is to update or insert automatically, depending on if the ID already exists in the datastore for the object. So persist method figures out insert or update. You can do things after commit, but you won't be able to roll back. Y

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-27 Thread Zeno
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.currentT

[appengine-java] Re: jdo update is inserting when I don't want it to

2011-04-26 Thread branflake2267
pm.makePersistent( persistme ); is called after the deletion it will recreate it. You'll have to query it by objectid first and see if it exists. If it exists you could update. SQL would need an ID to update, but in JDO, it will make a new ID on insert and update depending on existence. like so