Any entity object must define an Id. The Id is used by EclipseLink for caching, object identity and to unique identify an object in the data-store. NoSQL databases may have a concept of an Id, or may not. The <code>@GeneratedValue</code> option is supported with NoSQL. It maps to whatever id generating the NoSQL database provides, and if none is provided it makes use of a UUID. A UUID generated id must be declared as either a <code>String</code> or <code>byte[]</code>.

Any entity object must define an Id. The Id is used by EclipseLink for caching, object identity and to unique identify an object in the data-store. NoSQL databases may have a concept of an Id, or may not. The <code>@GeneratedValue</code> option is supported with NoSQL. It maps to whatever id generating the NoSQL database provides, and if none is provided it makes use of a UUID. A UUID generated id must be declared as either a <code>String</code> or <code>byte[]</code>.

−

====MongoDB Ids====

+

:MongoDB requires every document have an <code>_id</code> field. If the document does not have the field, then one will be generated by the database using an OID, which is similar to a UUID. An OID must be declared as either a <code>String</code> or <code>byte[]</code>. The application can define its own value for the <code>_id</code>, or can use a generated value. The entity Id is not required to match the MongoDB <code>_id</code>, and composite IDs are supported, but this is recommended to use <code>_id</code> as the Id field name.

−

MongoDB requires every document have an <code>_id</code> field. If the document does not have the field, then one will be generated by the database using an OID, which is similar to a UUID. An OID must be declared as either a <code>String</code> or <code>byte[]</code>. The application can define its own value for the <code>_id</code>, or can use a generated value. The entity Id is not required to match the MongoDB <code>_id</code>, and composite IDs are supported, but this is recommended to use <code>_id</code> as the Id field name.

+

−

====Oracle NoSQL Ids====

+

:Oracle NoSQL has a concept of major keys and minor keys. By default EclipseLink will create the major key as a composite key of the entity name and each of the entities Id values. Generated id values are supported using UUID.

−

Oracle NoSQL has a concept of major keys and minor keys. By default EclipseLink will create the major key as a composite key of the entity name and each of the entities Id values. Generated id values are supported using UUID.

Contents

Mapping

NoSQL maps objects to structured data such as XML or JSON. NoSQL support embedded data and embedded collections.
NoSQL supports all of the existing JPA mapping annotations and XML. @Column and @JoinColumn should not be used, instead @Field and @JoinField should be used. @JoinTable and @CollectionTable are not supported, or required.

Id

Any entity object must define an Id. The Id is used by EclipseLink for caching, object identity and to unique identify an object in the data-store. NoSQL databases may have a concept of an Id, or may not. The @GeneratedValue option is supported with NoSQL. It maps to whatever id generating the NoSQL database provides, and if none is provided it makes use of a UUID. A UUID generated id must be declared as either a String or byte[].

MongoDB requires every document have an _id field. If the document does not have the field, then one will be generated by the database using an OID, which is similar to a UUID. An OID must be declared as either a String or byte[]. The application can define its own value for the _id, or can use a generated value. The entity Id is not required to match the MongoDB _id, and composite IDs are supported, but this is recommended to use _id as the Id field name.

Oracle NoSQL has a concept of major keys and minor keys. By default EclipseLink will create the major key as a composite key of the entity name and each of the entities Id values. Generated id values are supported using UUID.

Basic

Basic mappings for NoSQL support all of the same options a regular JPA Basic mappings. Temporal types, converters, lobs, and enumerated options are supported. The @Field annotation or field should be used to define the field name. The field name will be the name of the field used in the object's data structure.

XML - field name can use XPath expressions. These include using '@' for attributes, '/' for nested elements, '[1]' for positional elements, and 'text()' for element text.

Oracle NoSQL - field names map to the minor keys in the key/value store.

NoSQL Examples

The following provides mappings for an Order model. The first example uses MAPPED data, such as mapping to a MongoDB JSON document. The second example uses XML data, such as mapping to XML files.