How to set default commit for transactions in goog

2019-09-15 16:35发布

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条回答
聊天终结者
2楼-- · 2019-09-15 17:28

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.

查看更多
登录 后发表回答