如何在谷歌应用程序引擎中设置事务的默认提交?
ObjectifyBookShelfDAO transactionalDao = new ObjectifyBookShelfDAO(true);
transactionDao.removeThis(item);
// Its get removed only after i commit
// Perform some operations
transactionDao.ofy().getTxn().commit();
有一种情况,我希望立即删除该对象...我该怎么做..
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 ..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎正在使用 objectify-appengine。如objectify 事务文档所述,如果您致电
removeThis()
在事务之外,它将立即发生。作为替代方案,objectify 允许您混合调用内置 低级 Java 数据存储 API。您可以使用它并调用
DatastoreService.delete()
而不传递事务。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.