简体   繁体   English

Google App Engine - 已删除的实体未被删除

[英]Google App Engine - Deleted Entity is not deleted

I'm trying to delete an entity in google datastore 我正在尝试删除Google数据存储区中的实体

String keyValue = "someValue";
Key tweetKey = KeyFactory.createKey("tweetKey", keyValue);
Entity someEntity = new Entity(tweetKey);

Entity getEntity = datastore.get(tweetKey);
datastore.delete(tweetKey);
getEntity = datastore.get(tweetKey);
if(getEntity != null)
{
   //This happens
   System.out.println("Something wrong");
}

The entity are not deleted, and it something wrong as the output 实体不会被删除,输出也有问题

Edit 1: I didn't copy and paste from the original code, because there are a lot of other logic in between getting and using values from the entity. 编辑1:我没有从原始代码中复制和粘贴,因为在获取和使用实体的值之间存在很多其他逻辑。

You are deleting a different key than the one you are checking. 您正在删除与您正在检查的密钥不同的密钥。

You are deleting the tweetKey and checking the tweetkey (notice the capital K in the first one). 您正在删除tweetKey并检查tweetkey (注意第一个中的大写tweetkey K )。 If this snippet is a copy paste from your original then that's the mistake. 如果此片段是原始文件的复制粘贴,那么这就是错误。

确保您没有活动的事务,如果您确实提交了事务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google App Engine 数据存储实体未被删除 - Google App Engine datastore Entity not being deleted 如何在Google App Engine(java)并发期间使删除的实体立即不可用? - How to make deleted entities unavailable immediately during concurrency in Google App Engine (java)? 无法部署到 Google App Engine,原因是:默认服务(模块)可能不会被删除,并且必须至少包含一个版本 - Can't deploy to Google App Engine due to: The default service (module) may not be deleted, and must comprise at least one version 删除应用程序时的消息 - Message while app is deleted JPA检查是否可以删除实体 - JPA Check if entity can be deleted 已删除的实体已传递给持久异常 - Deleted entity passed to persist exception 使用@Transactional在JUnit测试中不删除实体 - Entity is not deleted in a JUnit test with @Transactional EntityNotFoundException:删除的实体传递给持久化 - EntityNotFoundException: deleted entity passed to persist 用户卸载我的应用后,是否会删除Google云端硬盘应用文件夹? - Will the Google Drive appfolder be deleted after a user uninstalls my app? Android - 在Google PlayMarket中升级应用时,将删除包文件文件夹? - Android - Package files folder will be deleted while upgrading an app in Google PlayMarket?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM