How to set default commit for transactions in google app engine?

半腔热情 提交于 2019-12-13 05:44:37

问题


ObjectifyBookShelfDAO transactionalDao = new ObjectifyBookShelfDAO(true);  
transactionDao.removeThis(item);   
// Its get removed only after i commit     
// Perform some operations  
transactionDao.ofy().getTxn().commit();

There is a scenario where in i want this object to be removed on instant... How do i do this ..


回答1:


it looks like you're using objectify-appengine. as the objectify transaction docs describe, if you make your call to removeThis() outside of a transaction, it will happen immediately.

as an alternative, objectify lets you mix in calls to the built in low level java datastore API. you could use that and call DatastoreService.delete() without passing a transaction.



来源:https://stackoverflow.com/questions/4516487/how-to-set-default-commit-for-transactions-in-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!