本文介绍了如何在谷歌应用程序引擎中设置交易的默认提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ObjectifyBookShelfDAO transactionalDao = new ObjectifyBookShelfDAO(true);
transactionDao.removeThis(item);
//只有在我提交
后,它才会被删除//执行一些操作
transactionDao.ofy()。getTxn()。commit();
有一种情况,我希望此对象在即时被删除...我如何这样做。
解决方案
看起来您正在使用。正如 所述,如果您打电话给 removeThis()
在一个事务之外,它会立即发生。
作为替代,objectify可以让你混合调用内置的。您可以使用它并调用而不通过交易。
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 ..
解决方案
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.
这篇关于如何在谷歌应用程序引擎中设置交易的默认提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!