Design Specification: Support NoSQL Databases
|Date||Author||Version Description & Notes|
There are several "NoSQL" databases that are non-relational. These databases include:
- Oracle NoSQL
- Google BigTable
These databases offer alternative APIs to JDBC and either do not support querying, or support alternative query languages to SQL.
You could also include legacy hierarchical and non-relational databases, object databases and XML databases in the "NoSQL" category.
It is desirable for EclipseLink to support persistence and specifically JPA access to NoSQL databases.
EclipseLink currently provides persistence support for relational databases through JDBC, and non-relational datasources through JCA. This support requires a JDBC or JCA resource adapter/driver for the database. Most NoSQL databases do not provide a standard driver, although some may, and some do provide JDBC drivers. There are also third parties that provide JDBC and JCA driver to a wide range of datasources, including some NoSQL databases.
Users connecting EclipseLink to NoSQL databases have several options:
- If they have a JDBC driver available they can connect using EclipseLink's relational support, creating their own DatabasePlatform in EclipseLink will provide enhanced functionality and ease of use.
- If they have a JCA driver available they can connect using EclipseLink's EIS support, creating their own EISPlatform in EclipseLink will provide enhanced functionality and ease of use.
- They can implement their own JCA (or JDBC) adapter for their database to enable usage of EclipseLink's EIS support.
EclipseLink currently provides several JCA adapters to non-relational datasources. These include:
- Oracle AQ
- XML file adapter
EclipseLink should provide a platform and adapter to popular NoSQL databases, similar to the platforms provided for popular relational databases.
EclipseLink's EIS support currently has several limitations that must be resolved to support NoSQL databases.
- No JPA annotation or XML support is currently available for EIS descriptors, mappings, and queries.
- Although hooks exists, no current EIS adapters provide Expression (JPQL/Criteria) translation into non-SQL query languages or APIs.
- The JPA API has not been tested with EIS descriptors and datasources.
- NoSQL - see NoSQL - Wikipedia
- Hierarchical data - data that is nested like XML, not flat like relational data, most NoSQL data is hierarchical.
- EIS - Enterprise Information System, includes non-relational databases, gateways, transaction monitors, and applications. (VSAM, ADA, CICS, IMS, SAP, Salesforce, MongoDB, BigTable).
- Support JPA access to EIS and NoSQL databases.
- Support EIS JPA annotations and XML.
- Support JPQL subset (superset?) for NoSQL databases that support querying.
- Support mapping XML/JSON data from NoSQL databases.
- Support EISPlatforms and adapters for key NoSQL databases:
- Oracle NoSQL
- Some NoSQL databases do not support querying.
- Transaction semantics may be different, or even not exist in some NoSQL databases.
- Data and its access is non-standard and may require different types of mappings, queries or data access.
- NoSQL databases may be schema free, and may support storing of dynamic data.
- NoSQL databases provide non standard Java APIs, our adapters will require compile dependencies with these APIs.
Support EIS annotations and XML in JPA.
- @EIS annotation will allow a class to be tagged as mapping EIS data.
- JPA @Basic, @Embedded, @ElementCollection, @OneToOne, @ManyToOne, @OneToMany, @ManyToMany will be allowed for EIS classes and mapped to EIS mappings.
- @EisField annotation will allow defining the data field name, similar to @Column, (@Column will also be supported), (for non-XML data)
- @NamedEisInteractionQuery will allow a native query to be defined using an EIS interaction
- A subset of JAXB and Moxy annotations will be allowed, @XmlAttribute, @XmlElement, @XmlPath in place of @Column (to start with).
- Other JAXB annotations my be supported, or added in the future.
- Unsupported JAXB annotations will be checked for and log warnings or trigger errors.
Support JPA auto-mapping and defaulting.
- Defaulting rules will be similar to relational. Some JAXB defaulting rules may also be used.
Support JCA adapter for Oracle NoSQL.
- GET, PUT and DELETE operations will be supported.
- keyed XML data will be supported.
- nested keyed data will be supported.
- Oracle NoSQL does not support querying, so JPQL, Criteria querying will not be supported, only CRUD (find) and native interaction based queries will be supported.
- Oracle NoSQL has no transaction support, the JPA transaction API will be supported, but flushes will be committed and aborts will not rollback committed changes.
Support JCA adapter for MongoDB.
- JSON data mapped through MappedRecords.
- JSON data mapped through XMLRecords.
- A subset of JPQL and Criteria (through Expressions) will be translated to JSON based querying.
Testing will require access and installation to supported NoSQL databases.
Testing will be done locally by commiters responsible for the NoSQL database's integration (i.e. Oracle).
JPA and native API test models will be provided for Oracle NoSQL and MongoDB.
Oracle NoSQL will test:
- keyed XML data
- nested key-value pairs of string data
- possibly serialize data
MongoDB will test:
- JSON mapped data through XML
- @Eis - Tags descriptor as EIS
- @EisField - synonym for @Column
- JAXB - @XmlAttribute, @XmlElement
- Moxy - @XmlPath
- "eclipselink.eis.connection-spec" - JCA connection spec
- "eclipselink.eis.property" - JCA driver property (synonymy for "eclipselink.jdbc.property")
- "eclipselink.eis.platform" - EIS platform (synonymy for "eclipselink.target-database")
- "eclipselink.jdbc.property" - JDBC driver property
- "eclipselink.jdbc.connector" - JDBC connector
Need to document our BNF, example queries and support beyond JPA 2.0/2.1 in query section.
- Which NoSQL databases should be supported? Oracle NoSQL, MongoDB, Hadoop, BigTable, ...?
- Where should JCA adapters be developed?
- How to resolve compile dependencies with third party APIs and drivers?
- Oracle NoSQL and MongoDB were decided for initial investigation.
- Google BigTable
- Oracle Coherence (as a datasource instead of a cache)