如何获得谷歌应用程序引擎数据存储中的所有种类? [英] How to get all the kinds in the google app engine datastore?

查看:116
本文介绍了如何获得谷歌应用程序引擎数据存储中的所有种类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用java编写GAE,我已经阅读了GAE Java低级API,并且找不到我的问题的答案。 >我想知道是否有方法可以调用方法/执行JDOPL,并且它会返回我的数据存储中的所有不同类型的实体。

解决方案

您可以使用元数据API 。例如:

 查询查询=新查询(Entities.KIND_METADATA_KIND); 
DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService();

Iterable< Entity> entityIterable = datastoreService.prepare(query).asIterable(); (Entity entity:entityIterable){
System.out.println(Entity kind:+ entity.getKey()。getName());


}


I'm using java to code for GAE, I've read through the GAE Java low level API and can't find any answer to my question yet.

I wanna know if there's a way where I can call a method/do a JDOPL and it returns all the different kinds of entities in my Datastore.

解决方案

You can use the Metadata API. For example:

Query query = new Query(Entities.KIND_METADATA_KIND);
DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService();

Iterable<Entity> entityIterable = datastoreService.prepare(query).asIterable();

for(Entity entity : entityIterable) {
    System.out.println("Entity kind: " + entity.getKey().getName());
}

这篇关于如何获得谷歌应用程序引擎数据存储中的所有种类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆