Embedded classes allow you to model a field value using a class without
creating a new datastore entity and forming a relationship.
你可以使用嵌套类作为POJO的属性,这样,嵌套类就不会作为单独实体被保存在datastore中,也不和POJO类形成关联关系。
The embedded class does not need a primary key field because it is not stored as a separate entity.
嵌套类不需要主键,因为它不作为单独实体被保存。
If you have more than one field on the object whose type is an embedded
class, you must rename the fields of one so they do not conflict with
another.
如果你的POJO类中有两个或更多的属性,其类型属于同一嵌套类,那么你必须修改其中的一个或多个属性。
修改方式见下面的代码段:
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class EmployeeContacts {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Long id;
@Persistent
@Embedded
private ContactInfo homeContactInfo;
@Persistent
@Embedded(members = {
@Persistent(name = "streetAddress", columns = @Column(name = "workStreetAddress")),
@Persistent(name = "city", columns = @Column(name = "workCity")),
@Persistent(name = "stateOrProvince", columns = @Column(name = "workStateOrProvince")),
@Persistent(name = "zipCode", columns = @Column(name = "workZipCode")), })
private ContactInfo workContactInfo;
@PersistenceCapable
@EmbeddedOnly
public static class ContactInfo {
@Persistent
private String streetAddress;
@Persistent
private String city;
@Persistent
private String stateOrProvince;
@Persistent
private String zipCode;
// ... accessors ...
}
// ... accessors ...
}
将其保存后,查看Datastore Viewer,见附件。
分享到:
相关推荐
NULL 博文链接:https://jinjiankang.iteye.com/blog/429163
Google Datastore的JAR
Android DataStore使用和封装
This practical guide shows intermediate and advanced web and mobile app developers how to build highly scalable Java applications in the cloud with Google App Engine. The flagship of Google's Cloud ...
The journey begins with a look at the Google Plugin for Eclipse and finishes with a working web application that uses Google Web Toolkit, Google Accounts, and Bigtable. Along the way, you’ll dig ...
谷歌云数据存储注意:此存储库包含适用于 Google Cloud Datastore 的低级 Java 和 Python 客户端库。 有关这些语言的更多惯用和可用客户端库,请访问库的库。 您还可以在 Cloud Datastore 的上找到各种语言的受支持...
PB虛擬datastore用法-----------------------------------------------------------------------
Laravel开发-laravel-datastore Laravel数据存储框架。
NULL 博文链接:https://woods.iteye.com/blog/295703
Google APIs Client Library for Java Library Maintenance Overview Highlighted Features Dependencies Important Warnings @Beta Deprecations Documentation Links Library Maintenance These client ...
完整介绍创建datastore,根据条件在datastore中查询数据、取值;将取出的值赋值到新窗体新增行的字段中。
#导言: 在微服务结合前端AJAX越加普遍的今天,以一种没有后端的web开发理念,极大缩小了开发成本,此博客结合这个概念做了一个数据服务原型。 主要有如下特色: 用户只需以JSON格式定义... callbackKey: 'datastore_ca
However, building and deploying scalable web applications using Google Web Toolkit and Google App Engine for Java can be challenging even to developers. The start to finish approach of this book ...
前端开源库-datastore-fs数据存储fs,带有文件系统后端的数据存储实现
matlab开发-datastore。一种工具,用于在matlab会话之间保存与登录用户相关的数据。
一 、DataStore介绍 Jetpack DataStore 是一种改进的新数据存储解决方案,允许使用协议缓冲区存储键值对或类型化对 象。 DataStore 以异步、一致的事务方式存储数据,克服了 SharedPreferences(以下统称为SP)的 ...
适用于Node.js的Cloud Datastore客户端...安装客户端库npm install @google-cloud/datastore使用客户端库// Imports the Google Cloud client libraryconst { Datastore } = require ( '@google-cloud/datastore' ) ;//
Pick the right managed service for your data needs, choosing intelligently between Datastore, BigTable, and BigQuery Migrate existing Hadoop, Spark, and Pig workloads with minimal disruption to your ...
Google Cloud Datastore模拟器 该软件包有助于使用javascript启动/停止 。 从1.1.0版开始,也可以与 docker image一起使用。 包装器会自动拉出主机上不存在的映像,但是我建议在CI脚本的“ before_test”部分中拉出...