Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

EclipseLink/UserGuide/JPA/Advanced JPA Development/NoSQL/Persistence Units

Warning For EclipseLink 2.4 (and newer) refer to "Understanding Non-relational Data Sources" in the EclipseLink Concepts Guide:

EclipseLink JPA

Mailing ListForumsIRCmattermost
OpenHelp WantedBug Day
Browse Source

NoSQL Persistence Units

NoSQL persistence units are configured the same as JPA persistence units. The persistence.xml is used to define the persistence unit. NoSQL persistence units can be application managed, JTA managed, injected, or created through Persistence the same as regular JPA persistence units. NoSQL persistence units do have some specific persistence unit properties that are required, and have some limitations.

NoSQL defines the following persistence unit properties:

  • "eclipselink.nosql.connection-spec" - this specifies an EISConnectionSpec class name that defines how to connect to the NoSQL data-source.
  • "eclipselink.nosql.connection-factory" - this specifies the JNDI name of a JCA ConnectionFactory, or a JCA ConnectionFactory class name that connects to the NoSQL data-source.
  • "" - this prefix is used to pass driver specific properties to the NoSQL connection spec.
  • "" - this is used to set the NoSQL platform class, or use "org.eclipse.persistence.eis.EISPlatform" for a generic platform.

NoSQL persistence units have the following restrictions:

  • <jta-data-source>, <non-jta-data-source> - these are not supported, as they refer to JDBC DataSources.
  • JTA - JTA managed persistence units are supported, but XA transactions may not be provided unless the NoSQL JCA resource adapter supports JTA.
  • "javax.jdbc.", "eclipselink.jdbc." - JDBC specific properties are not supported as NoSQL does not use JDBC.

MongoDB persistence.xml example

<persistence xmlns="" xmlns:xsi="" xsi:schemaLocation=" persistence_2_0.xsd" version="2.0">
    <persistence-unit name="acme" transaction-type="RESOURCE_LOCAL">
            <property name="" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/>
            <property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/>
            <property name="" value="27017, 27017"/>
            <property name="" value="host1, host2"/>
            <property name="" value="acme"/>

NoSQL Platforms

EclipseLink provides the following NoSQL platforms and connection specs. To use a NoSQL platform you must set both the "eclipselink.nosql.connection-spec" to the connection spec class name and the "" to the platform class name. Each NoSQL platform also supports platform specific properties that can be set using "".

MongoDB properties

Property Value
"" "org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"
"eclipselink.connection-spec" "org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"
"" comma separated list of MongoDB hosts
"" comma separated list of MongoDB host's ports
"" MongoDB database
"" default ReadPreference (PRIMARY, SECONDARY)
"" default options (integer value)

Oracle NoSQL properties

Property Value
"" "org.eclipse.persistence.nosql.adapters.nosql.OracleNoSQLPlatform"
"eclipselink.connection-spec" "org.eclipse.persistence.nosql.adapters.nosql.OracleNoSQLConnectionSpec"
"" comma separated list of Oracle NoSQL hosts
"" Oracle NoSQL store

XML file properties

Property Value
"" "org.eclipse.persistence.eis.adapters.xmlfile.XMLFilePlatform"
"eclipselink.connection-spec" "org.eclipse.persistence.eis.adapters.xmlfile.XMLFileEISConnectionSpec"
"" directory of xml files

JMS properties

Property Value
"" "org.eclipse.persistence.eis.adapters.jms.JMSPlatform"
"eclipselink.connection-spec" "org.eclipse.persistence.eis.adapters.jms.JMSEISConnectionSpec"
"" URL for JMS ConnectionFactory
"" JMS ConnectionFactory

Oracle AQ properties

Property Value
"" ""
"eclipselink.connection-spec" ""
"" JDBC datasource URL

Version: 2.4.0 DRAFT
Other versions...

Back to the top