Re: [appengine-java] how to keep fields unique

2011-03-07 Thread emurmur
It turns out the technique I described in my previous post has two issues. 1. Because only one transaction can be running at a time within a process, and the entity used as the mutex really cannot be in the same entity group as the primary entity, you can get into a situation where the mutex ent

Re: [appengine-java] how to keep fields unique

2011-03-04 Thread Ed Murphy
OK, here is something that looks promising; http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/ This shows a solution in python, but the concept is applicable to Java. Basically, for the unique field, you create another database entity and derive a primary Key based

Re: [appengine-java] how to keep fields unique

2011-03-04 Thread Ed Murphy
I'm struggling with a bug that is closely related to this thread. I think transactions all by themselves will not work here. This is because the transactions are optimistic. So, if the transaction looks like this (pseudo code) pm.currentTransaction.begin(); Object preexistingEntity = pm.quer

Re: [appengine-java] how to keep fields unique

2010-02-16 Thread John Patterson
You could use transactions if all Servers are in the same entity group. In a transaction you can query for existing A specifying the ancestor in the query. When you find no other Server with the key you can store it - also with the same ancestor - then commit the transaction. If another

[appengine-java] how to keep fields unique

2010-02-16 Thread smile laugh
hello everyone I have several fields which must be unique because of business logic.how can app engine make the unique key for the several fields? For example, in a Server "A" ,I query a value and find there is no existing value , so I insert value into Server "A" successfully. But almost the sa