Contents

@NoSQL

Mapping to NoSQL data is configured through the EclipseLink @NoSQL annotation, and <no-sql> XML element.
@NoSQL defines the class as mapping to non-relational data. @NoSQL can be specified with @Entity or @Embeddable classes.

The @NoSQL annotation defines a dataType and a dataFormat. The dataType is name for the entities structure, the meaning of the dataType is dependent on the NoSQL platform. For MongoDB, it is the collection name that the JSON documents are stored to. For Oracle NoSQL the dataType is the first part of the major key value. For the XML file adapter it is the file name.

The dataFormat specifies the type of structure the data is stored as. The dataFormat is defined by the DataFormatType enum.
Three types of NoSQL data formats are supported:

XML - maps a class to an XML document, this can be used with XML data-stores, XML files, XML messaging systems, and other XML systems.

MAPPED - maps a class to a set of nested key/value pairs, a value can be an embedded map or list. This can be used to map to key/value stores, JSON databases, and other structured data systems.

INDEXED - maps a class to an array of values.

The dataFormat is dependent on the NoSQL platform. MongoDB must use the MAPPED format. Oracle NoSQL can use either the MAPPED format for key/value data, or the XML format for a single XML document value. XML files and XML messaging use the XML format.

@Table, @SecondaryTable - are not supported with NoSQL, as objects are not mapped to tables, it is replaced by the dataType on the @NoSQL annotation.

@Column - @Field should be used for NoSQL, as data is not stored in table columns, however @Column is still allowed, but just the name will be used.

@JoinColumn - is not supported with NoSQL, it is replaced by @JoinField.

@JoinTable - is not required or supported with NoSQL, OneToManys and ManyToManys are stored as collections of ids embedded in the source object's data structure.

@CollectionTable - is not required or supported with NoSQL, ElementCollections are embedded in the parent object's data structure.

@MapKeyColumn, @MapKeyClass, @MapKeyJoinColumn - are not currently supported.

@OrderBy, @OrderColumn - are not normally required or supported, as order in normally maintained by the object's data structure.

@SequenceGenerator, @TableGenerator - are not directly supported.

@AttributeOverride, @AssociationOverride - are supported with inheritance, but are not supported or required with embedded relationships as embedded objects are nested in their parent object's data structure, not flatten as in the case of relational data.