I’m using HRD because I want make changes to multiple entities within a single transaction using entity groups.
Understand that Non transactional (non ancestor) queries may see all, some, or none of the results of a previously committed transaction.
The problem I facing now is:
After commit an transaction for adding new record to db
Transaction tx = pm.currentTransaction();
tx.begin();
pm.makePersistent(object);
tx.commit();
-
Follow by query the record committed, sometime it will return result and some time just return as null
Query q = pm.newQuery(queryStatement); CompanyProfile result = (CompanyProfile) q.execute();
p/s: When turn off HRD, it work perfectly.
Any workaround?
Thanks
Rgds
SJ
There is no way around it: HRD is always eventually consistent: http://code.google.com/appengine/docs/python/datastore/queries.html#Setting_the_Read_Policy_and_Datastore_Call_Deadline
One way around it would be to use get instead of query. Get/put/delete are strongly consistent in HRD, while query is eventually consistent: http://code.google.com/appengine/docs/java/datastore/hr/
If this is a immediate-query-after-save scenario within one user session, you could query data and add a saved entity to the list by hand.