google app engine - Transaction to find an entity - locks all entities of that type? -


reading docs transactions:

http://code.google.com/appengine/docs/java/datastore/transactions.html

an example provided shows 1 way make instance of object:

try {     tx.begin();      key k = keyfactory.createkey("salesaccount", id);     try {         account = pm.getobjectbyid(employee.class, k);     } catch (jdoobjectnotfoundexception e) {         account = new salesaccount();         account.setid(id);     }      ... 

when above transaction gets executed, block other write attempts on account objects? i'm wondering because i'd have user signup checks username or email in use:

tx.begin();  "select user musername == str1 limit 1"; if (count > 0) {     throw new exception("username in use!"); }  "select user memail == str1 limit 1"; if (count > 0) {     throw new exception("email in use!"); }  pm.makepersistent(user(username, email)); // ok.  tx.commit(); 

but above more time consuming think, making worse bottleneck? understanding happen correctly?

thanks

no, transactions operate on entity groups, is, set of entities same root entity. grouping has nothing @ entity kind; entity's parent can of type.

by default, of entities root entities, means each entity group of 1 entity. unless explicitly set parent entity when create new entity, behavior you'll get.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -