Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 删除特定类型的所有实体_Java_Google App Engine_Jpql - Fatal编程技术网

Java 删除特定类型的所有实体

Java 删除特定类型的所有实体,java,google-app-engine,jpql,Java,Google App Engine,Jpql,我试图从GAE应用程序中的数据存储中删除特定类型的所有实体。我有以下几行: em.createQuery("DELETE m FROM "+UpdateMessage.class.getSimpleName()+" m").executeUpdate(); 我看到以下例外情况: Unable to update most recent message in datatstore: Candidate class could not be found: DELETE 我假设我没有正确地

我试图从GAE应用程序中的数据存储中删除特定类型的所有实体。我有以下几行:

em.createQuery("DELETE m FROM "+UpdateMessage.class.getSimpleName()+" m").executeUpdate();  
我看到以下例外情况:

 Unable to update most recent message in datatstore: Candidate class could not be found: DELETE 
我假设我没有正确地使用别名,因为它将DELETE误认为是实际的类。我试着在没有别名的情况下从MyClassType中删除
DELETE,但似乎不起作用


有什么想法吗?

如果要删除所有实体,则不需要此处所述的变量[1]

另外,您使用的是getSimpleName()方法,我对JPA知之甚少,但我看到的所有代码段都使用getName()方法。请参见此处的差异[2]。因此,查询将是:

em.createQuery("DELETE FROM " + UpdateMessage.class.getName()).executeUpdate();  
[1]

[2]