Skip to main content
Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/JPA/NoSQL"

(@NoSQL)
Line 7: Line 7:
 
|apis=
 
|apis=
 
*[http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/NoSQL.html @NoSQL]
 
*[http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/NoSQL.html @NoSQL]
 +
*[http://www.eclipse.org/eclipselink/api/latest/org/eclipse/persistence/annotations/DataFormatType.html DataFormatType]
 
|nativeapi=y
 
|nativeapi=y
 
|nativeapis=
 
|nativeapis=
Line 32: Line 33:
 
The <code>dataFormat</code> specifies the type of structure the data is stored as.  The <code>dataFormat</code> is defined by the <code>DataFormatType</code> enum.
 
The <code>dataFormat</code> specifies the type of structure the data is stored as.  The <code>dataFormat</code> is defined by the <code>DataFormatType</code> enum.
 
Three types of NoSQL data formats are supported:
 
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.
+
* <code>XML</code> - 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.
+
* <code>MAPPED</code> - 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.
+
* <code>INDEXED</code> - maps a class to an array of values.
  
The <code>dataFormat</code> 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.
+
The <code>dataFormat</code> is dependent on the NoSQL platform.  MongoDB must use the <code>MAPPED</code> format.  Oracle NoSQL can use either the <code>MAPPED</code> format for key/value data, or the <code>XML</code> format for a single XML document value.  XML files and XML messaging use the <code>XML</code> format.
  
 
====NoSQL example====
 
====NoSQL example====
Line 55: Line 56:
 
|previous=
 
|previous=
 
|up=[[EclipseLink/UserGuide/JPA/Advanced JPA Development|Advanced JPA Development]]
 
|up=[[EclipseLink/UserGuide/JPA/Advanced JPA Development|Advanced JPA Development]]
|next=[[EclipseLink/UserGuide/JPA/NoSQL/Mappings]]  
+
|next=[[EclipseLink/UserGuide/JPA/NoSQL/Mappings|Mappings]]  
 
|version=2.4.0 DRAFT}}
 
|version=2.4.0 DRAFT}}

Revision as of 14:43, 25 April 2012

EclipseLink JPA

Eclipselink-logo.gif
EclipseLink
Website
Download
Community
Mailing ListForumsIRCmattermost
Issues
OpenHelp WantedBug Day
Contribute
Browse Source

Elug api package icon.png Native API

NoSQL

NoSQL is a classification of database systems that do not support the SQL standard. These include document databases, key-value stores, and various other non-standard databases. EclipseLink supports persistence of Java objects to NoSQL databases through the Java Persistence API (JPA). EclipseLink's native API is also supported with NoSQL databases.

The NoSQL classification can also be expanded to include Enterprise Information Systems (EIS) including application databases, legacy databases, messaging systems, and transaction processing monitors.

EclipseLink's NoSQL support includes:

  • MongoDB
  • Oracle NoSQL
  • XML files
  • JMS
  • Oracle AQ

@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.

NoSQL example

@Entity
@NoSQL(dataType="orders", dataFormat=DataFormatType.MAPPED)
public class Order {
  @Id
  private long id;
  ...
}



Eclipselink-logo.gif
Version: 2.4.0 DRAFT
Other versions...

Back to the top