The Eclipse JNoSQL Database API is a collection of implementations from the Jakarta NoSQL specification.
ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript extensions.
This API offers support for Document and Key-Value types. The Graph is possible through Apache TinkerPop.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-arangodb</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.ArangoDBConfigurations
Configuration property | Description |
---|---|
|
The database host, where you need to put the port split by colons. E.g.: jnosql.jnosql.arangodb.host=localhost:8529 |
|
The user’s userID. |
|
The user’s password |
|
The connection and request timeout in milliseconds. |
|
The chunk size when Protocol is used. |
|
The true SSL will be used when connecting to an ArangoDB server. |
|
The com.arangodb.entity.LoadBalancingStrategy as String. |
|
The com.arangodb.Protocol as String |
|
The maximum number of connections the built-in connection pool will open per host. |
|
Set hosts split by comma |
This is an example using ArangoDB’s Document API with MicroProfile Config.
jnosql.document.provider=org.eclipse.jnosql.databases.arangodb.communication.ArangoDBDocumentConfiguration
jnosql.document.database=<DATABASE>
jnosql.arangodb.host=localhost:8529
This is an example using ArangoDB’s Key-Value API with MicroProfile Config.
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.arangodb.communication.ArangoDBKeyValueConfiguration
jnosql.keyvalue.database=<DATABASE>
jnosql.arangodb.host=localhost:8529
The config settings are the default behavior; nevertheless, there is an option to do it programmatically. Create a class that implements the Supplier<ArangoDBDocumentManager>
and then defines it as an @Alternative
and the Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<ArangoDBDocumentManager> {
@Produces
public ArangoDBDocumentManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
ArangoDBDocumentConfiguration configuration = new ArangoDBDocumentConfiguration();
ArangoDBDocumentManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
The
interface is an extension of the Repository interface that allows execution of AQL via the ArangoDBRepository
annotation. Also, it’s possible to combine with @AQL
annotation to execute parameterized AQL queries:@Param
@Repository
interface PersonRepository extends ArangoDBRepository<Person, String> {
@AQL("FOR p IN Person RETURN p")
List<Person> findAll();
@AQL("FOR p IN Person FILTER p.name = @name RETURN p")
List<Person> findByName(@Param("name") String name);
}
The
annotation is a mapping annotation that allows to define dynamic queries following ArangoDB Query Languange on @AQL
.ArangoDBRepository
interface CarRepository extends ArangoDBRepository<Car, String> {
@AQL("FOR c IN Car RETURN c")
List<Car> findAll();
}
For parameterized queries, use the
annotation for binding the target argument to the parameter informing the named parameter like the below example:@Param
interface OrderRepository extends ArangoDBRepository<Order, String> {
@AQL("FOR o IN Order FILTER o.customer = @customer RETURN o")
List<Order> findByCustomer(@Param("customer") String customer);
}
Apache Cassandra is a free and open-source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-cassandra</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.CassandraConfigurations
Configuration property | Description |
---|---|
|
The user’s userID. |
|
The user’s password |
|
Database’s host. It is a prefix to enumerate hosts. E.g.: jnosql.cassandra.host.1=localhost |
|
The name of the application using the created session. |
|
The cassandra’s port |
|
The Cassandra CQL to execute when the configuration starts. It uses as a prefix. E.g.: jnosql.cassandra.query.1=<CQL> |
|
The datacenter that is considered "local" by the load balancing policy. |
This is an example using Cassandra with MicroProfile Config.
jnosql.column.provider=org.eclipse.jnosql.databases.cassandra.communication.CassandraConfiguration
jnosql.column.database=developers
jnosql.cassandra.query-1=<CQL-QUERY>
jnosql.cassandra.query.2=<CQL-QUERY-2>
The config settings are the default behavior; nevertheless, there is an option to do it programmatically. Create a class that implements the Supplier<CassandraColumnManager>
and then defines it as an @Alternative
and the Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<CassandraColumnManager> {
@Produces
public CassandraColumnManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
CassandraConfiguration configuration = new CassandraConfiguration();
CassandraColumnManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
The
interface is an extension of the CassandraRepository
interface that allows execution of CQL and Consistency Level via the Repository
annotation.@CQL
@Repository
interface PersonRepository extends CassandraRepository<Person, String> {
@CQL("select * from Person")
List<Person> findAll();
@CQL("select * from Person where name = ?")
List<Person> findByName(String name);
@CQL("select * from Person where age = :age")
List<Person> findByAge(@Param("age") Integer age);
}
The
contains a UDT attribute for mapping annotation that allows defining a field to be stored as a user-defined type in Cassandra.@Column
@Entity
public class Person {
@Id("name")
private String name;
@Column
private Integer age;
@Column(udt="address")
private Address home;
}
-
TimestampConverter: That converts to/from java.util.Date
-
LocalDateConverter: That converts to/from com.datastax.driver.core.LocalDate
@Column
@Convert(value = TimestampConverter.class)
private LocalDateTime localDateTime;
@Column
@Convert(value = LocalDateConverter.class)
private Calendar calendar;
The Couchbase driver provides an API integration between Java and the database through a standard communication level.
This driver has support for two NoSQL API types: Document and Key-Value.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-couchbase</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.CouchbaseConfigurations
Configuration property | Description |
---|---|
|
The host at the database. |
|
The user’s userID. |
|
The user’s password |
|
The scope to use at couchbase otherwise, it will use the default. |
|
couchbase collection split by a comma. At the start-up of a CouchbaseConfiguration, there is this option to check if these collections exist; if not, it will create using the default settings. |
|
A default couchbase collection. When it is not defined the default value comes from Bucket. |
|
A couchbase collection index. At the start-up of a {@link CouchbaseConfiguration}, it will read this property to check if the index does exist, if not it will create combined by scope and the database. |
This is an example using Couchbase’s Document API with MicroProfile Config.
jnosql.document.provider=org.eclipse.jnosql.databases.couchbase.communication.CouchbaseDocumentConfiguration
jnosql.document.database=heroes
jnosql.couchbase.host.1=localhost
jnosql.couchbase.user=root
jnosql.couchbase.password=123456
This is an example using Couchbase’s Key-Value API with MicroProfile Config.
jnosql.keyvalue.database=heroes
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.couchbase.communication.CouchbaseKeyValueConfiguration
jnosql.couchbase.host.1=localhost
jnosql.couchbase.user=root
jnosql.couchbase.password=123456
The config settings are the default behavior; nevertheless, there is an option to do it programmatically. Create a class that implements the Supplier<CouchbaseDocumentManager>
and then defines it as an @Alternative
and the Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<CouchbaseDocumentManager> {
@Produces
public CouchbaseDocumentManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
CouchbaseDocumentConfiguration configuration = new CouchbaseDocumentConfiguration();
CouchbaseDocumentManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
The
interface is an extension of the CouchbaseRepository
interface that allows execution of N1QL via the Repository
annotation.@N1QL
@Repository
interface PersonRepository extends CouchbaseRepository<Person, String> {
@N1QL("select * from Person")
List<Person> findAll();
@N1QL("select * from Person where name = $name")
List<Person> findByName(@Param("name") String name);
}
The CouchDB driver provides an API integration between Java and the database through a standard communication level.
This driver provides support for the Document NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-couchdb</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.CouchDBConfigurations
Configuration property | Description |
---|---|
|
The port connection to a client connect. The default value is "5984" |
|
The max of connection that the couchdb client have. The default value is "20" |
|
The timeout in milliseconds used when requesting a connection. The default value is "1000". |
|
The socket timeout in milliseconds, which is the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets). The default value is "10000". |
|
The current maximum response body size that will be cached. The value is "8192". |
|
The maximum number of cache entries the cache will retain. The default value is "1000". |
|
The host at the database. |
|
The user’s userID. |
|
The user’s password |
|
If the request use a https or a http. |
|
Determines whether compressed entities should be decompressed automatically. |
This is an example using CouchDB’s Document API with MicroProfile Config.
jnosql.document.provider=org.eclipse.jnosql.databases.couchdb.communication.CouchDBDocumentConfiguration
jnosql.document.database=heroes
jnosql.couchdb.host=localhost
jnosql.couchdb.username=admin
jnosql.couchdb.password=password
Amazon DynamoDB is a fully managed, serverless, key-value and document NoSQL database designed to run high-performance applications at any scale. DynamoDB offers built-in security, continuous backups, automated multi-Region replication, in-memory caching, and data import and export tools.
This driver has support for two NoSQL API types: Key-Value and Document.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-dynamodb</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.DynamoDBConfigurations
Please note that you can establish properties using the MicroProfile Config specification.
Configuration property | Description |
---|---|
|
DynamoDB’s URL |
|
Configure the region with which the application should communicate. |
|
Define the name of the profile that should be used by this credentials provider. |
|
The AWS access key, used to identify the user interacting with AWS. |
|
The AWS secret access key, used to authenticate the user interacting with AWS. |
This is an example using DynamoDB’s Key-Value API with MicroProfile Config.
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.dynamodb.communication.DynamoDBKeyValueConfiguration
jnosql.keyvalue.database=heroes
The DynamoDB’s Document API implementation follows the SINGLE TABLE strategy, it means, the table will store multiple entity types. To satisfy this strategy, the implementation assumes that the target table will have a composed primary key:
-
The
entityType
field as the partitioning key; -
The
id
field as the sort key;
To customize the partitioning key field name, you can define the following configuration
jnosql.dynamodb.entity.pk=entityType
By default, the implementation doesn’t create the table on-the-fly, letting this requirement for the users. If you prefer, the implementation is able to create the table on-the-fly as well. To activate this capability you should define explicitly the following configuration:
jnosql.dynamodb.create.tables=true
The table will be created with the composed primary key mentioned previously.
Here’s an example using DynamoDB’s Document API with MicroProfile Config.
jnosql.document.provider=org.eclipse.jnosql.databases.dynamodb.communication.DynamoDBDocumentConfiguration
jnosql.document.database=heroes
The config settings are the default behavior; nevertheless, there is an option to do it programmatically. Create a class that implements the Supplier<DynamoDBDocumentManager>
and then defines it as an @Alternative
and the Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<DynamoDBDocumentManager> {
@Produces
public DynamoDBDocumentManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
DynamoDBDocumentConfiguration configuration = new DynamoDBDocumentConfiguration();
DynamoDBDocumentManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
The
interface is an extension of the DynamoDBRepository
interface that allows execution of PartiQL via the Repository
annotation.@PartiQL
Warning
|
DynamoDB supports a limited subset of PartiQL. |
Note
|
This implementation doesn’t provide pagination on the queries. |
@Repository
interface PersonRepository extends DynamoDBRepository<Person, String> {
@PartiQL("select * from Person")
List<Person> findAll();
@PartiQL("select * from Person where name = ?")
List<Person> findByName(@Param("") String name);
}
The
interface is a specialization of the DynamoDBTemplate
interface that allows using PartiQL queries.DocumentTemplate
Warning
|
DynamoDB supports a limited subset of PartiQL. |
Note
|
This implementation doesn’t provide pagination on the queries. |
List<Person> people = template.partiQL("select * from Person where name = ? ", params);
Elasticsearch is a search engine based on Lucene. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Elasticsearch is developed in Java and is released as open source under the terms of the Apache License. Elasticsearch is the most popular enterprise search engine followed by Apache Solr, also based on Lucene.
This driver provides support for the Document NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-elasticsearch</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.ElasticsearchConfigurations
Configuration property | Description |
---|---|
|
Database’s host. It is a prefix to enumerate hosts. E.g.: jnosql.elasticsearch.host.1=172.17.0.2:1234 |
|
The user’s userID. |
|
The user’s password |
This is an example using Elasticsearch’s Document API with MicroProfile Config.
jnosql.document.provider=org.eclipse.jnosql.databases.elasticsearch.communication.ElasticsearchDocumentConfiguration
jnosql.document.database=developers
The config settings are the default behavior; nevertheless, there is an option to do it programmatically. Create a class that implements the Supplier<ElasticsearchDocumentManager>
and then defines it as an @Alternative
and the Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<ElasticsearchDocumentManager> {
@Produces
public ElasticsearchDocumentManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
ElasticsearchDocumentConfiguration configuration = new ElasticsearchDocumentConfiguration();
ElasticsearchDocumentManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
The
interface is a specialization of the ElasticsearchTemplate
interface that allows using a search engine on both synchronous and asynchronous.DocumentTemplate
@Inject
ElasticsearchTemplate template;
...
QueryBuilder queryBuilder = boolQuery().filter(termQuery("name", "Ada"));
List<Person> people = template.search(queryBuilder, "Person");
Hazelcast is an open source in-memory data grid based on Java.
This driver provides support for the Key-Value NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-hazelcast</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.HazelcastConfigurations
Configuration property | Description |
---|---|
|
The instance name uniquely identifying the hazelcast instance created by this configuration. This name is used in different scenarios, such as identifying the hazelcast instance when running multiple instances in the same JVM. |
|
Database’s host. It is a prefix to enumerate hosts. E.g.: jnosql.hazelcast.host.1=localhost |
|
The database port |
|
The maximum number of ports allowed to use. |
|
Sets if a Hazelcast member is allowed to find a free port by incrementing the port number when it encounters an occupied port. |
|
Enables or disables the multicast discovery mechanism |
|
Enables or disables the Tcp/Ip join mechanism. |
This is an example using Hazelcast’s Key-Value API with MicroProfile Config.
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.hazelcast.communication.HazelcastKeyValueConfiguration
jnosql.keyvalue.database=heroes
The config settings are the default behavior; nevertheless, there is an option to do it programmatically. Create a class that implements the Supplier<HazelcastBucketManager>
and then defines it as an @Alternative
and the Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<HazelcastBucketManager> {
@Produces
public HazelcastBucketManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
HazelcastKeyValueConfiguration configuration = new HazelcastKeyValueConfiguration();
HazelcastBucketManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
@Repository
interface PersonRepository extends HazelcastRepository<Person, String> {
@Query("active")
List<Person> findActive();
@Query("name = :name AND age = :age")
Set<Person> findByAgeAndInteger(@Param("name") String name, @Param("age") Integer age);
}
The
interface is a specialization of the HazelcastTemplate
interface that allows execution of a Hazelcast query.KeyValueTemplate
Collection<Person> people = template.query("active");
Collection<Person> people2 = template.query("age = :age", singletonMap("age", 10));
Collection<Person> people3 = template.query(Predicates.equal("name", "Poliana"));
HBase is an open source, non-relational, distributed database modeled after Google’s BigTable and is written in Java.
This driver provides support for the Column Family NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-hbase</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.HbaseConfigurations
Configuration property | Description |
---|---|
|
The Column family prefixes. E.g.: jnosql.hbase.family.1=<FAMILY> |
This is an example using HBase’s Column Family NoSQL API with MicroProfile Config.
jnosql.document.provider=org.eclipse.jnosql.databases.hbase.communication.HBaseColumnConfiguration
jnosql.column.database=heroes
Infinispan is a distributed in-memory key/value data store with optional schema, available under the Apache License 2.0.
This driver provides support for the Key-Value NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-infinispan</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.InfinispanConfigurations
Configuration property | Description |
---|---|
|
Database’s host. It is a prefix to enumerate hosts. E.g.: jnosql.infinispan.host.1=HOST |
|
The Infinispan configuration path. E.g.: jnosql.infinispan.config=infinispan.xml |
This is an example using Infinispan’s Key-Value API with MicroProfile Config.
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.infinispan.communication.InfinispanKeyValueConfiguration
jnosql.keyvalue.database=heroes
jnosql.infinispan.config=infinispan.xml
Memcached is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read. Memcached is free and open-source software, licensed under the Revised BSD license. Memcached runs on Unix-like operating systems (at least Linux and OS X) and on Microsoft Windows.
This driver provides support for the Key-Value NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-memcached</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.MemcachedConfigurations
Configuration property | Description |
---|---|
|
The daemon state of the IO thread (defaults to true). |
|
The maximum reconnect delay |
|
The protocol type net.spy.memcached.ConnectionFactoryBuilder.Protocol |
|
The locator type net.spy.memcached.ConnectionFactoryBuilder.Locator |
|
Custom wait time for the authentication on connect/reconnect. |
|
The maximum amount of time (in milliseconds) a client is willing to wait for space to become available in an output queue. |
|
The default operation timeout in milliseconds. |
|
The read buffer size. |
|
The default operation optimization is not desirable. |
|
The maximum timeout exception threshold. |
|
Enable the Nagle algorithm. |
|
The user’s userID |
|
The user’s password. |
|
Database’s host. It is a prefix to enumerate hosts. E.g.: jnosql.memcached.host.1=localhost:11211 |
This is an example using Memcached’s Document API with MicroProfile Config.
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.memcached.communication.MemcachedKeyValueConfiguration
jnosql.keyvalue.database=heroes
jnosql.memcached.host.1=localhost:11211
MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas.
This driver provides support for the Document NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-mongodb</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.MongoDBDocumentConfigurations
Configuration property | Description |
---|---|
|
The database host as prefix. E.g.: mongodb.host.1=localhost:27017 |
|
The user’s userID. |
|
MongoDB’s connection string |
|
The user’s password |
|
The source where the user is defined. |
|
Authentication mechanisms com.mongodb.AuthenticationMechanism |
This is an example using Mongodb’s Document API with MicroProfile Config.
jnosql.document.database=olympus
jnosql.mongodb.host=localhost:27017
jnosql.document.provider=org.eclipse.jnosql.databases.mongodb.communication.MongoDBDocumentConfiguration
The config settings are the default behavior; nevertheless, there is an option to do it programmatically. Create a class that implements the Supplier<MongoDBDocumentManager>
and then defines it as an @Alternative
and the Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<MongoDBDocumentManager> {
@Produces
public MongoDBDocumentManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
MongoDBDocumentConfiguration configuration = new MongoDBDocumentConfiguration();
MongoDBDocumentManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
In this extension, you have the option to convert to/from the MongoDB
.ObjectID
@Entity
public class Music {
@Id
@Convert(ObjectIdConverter.class)
private String id;
}
The
interface is a specialization of the MongoDBTemplate
interface that allows MongoDB particular behavior such as delete and select elements using a DocumentTemplate
Bson
implementation and aggreate query.
@Inject
MongoDBTemplate template;
...
Bson filter = eq("name", "Poliana");
Stream<Person> stream = template.select(Person.class , filter);
Oracle NoSQL Database is a versatile multi-model database offering flexible data models for documents, graphs, and key-value pairs. It empowers developers to build high-performance applications using a user-friendly SQL-like query language or JavaScript extensions.
This API provides support for Document and Key-Value data types.
You can include Oracle NoSQL as a dependency using either Maven or Gradle:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-oracle-nosql</artifactId>
<version>1.1.3</version>
</dependency>
The API offers the OracleNoSQLConfigurations
class to programmatically set up credentials. It also supports configuration via the MicroProfile Config specification.
Property Name | Description |
---|---|
|
Hostname or IP address of the Oracle NoSQL database server. |
|
Username for Oracle NoSQL database authentication. |
|
Password for Oracle NoSQL database authentication. |
|
Desired throughput of read operations when creating tables with Eclipse JNoSQL. |
|
Desired throughput of write operations when creating tables with Eclipse JNoSQL. |
|
Maximum storage in gigabytes for tables created with Eclipse JNoSQL. |
|
Total waiting time in milliseconds when creating a table. |
|
Time between polling attempts in milliseconds when creating a table. |
|
Tenant ID for Oracle NoSQL database in a Cloud deployment. |
|
Fingerprint for authentication with Oracle NoSQL database in a Cloud deployment. |
|
Private key for authentication with Oracle NoSQL database in a Cloud deployment. |
|
Compartment name in Oracle Cloud Infrastructure. |
|
Namespace name in Oracle NoSQL on-premises. |
|
Specifies the profile name used to load session token in Oracle NoSQL cloud. |
|
Specifies the path of configuration file used to load session token in Oracle NoSQL cloud. |
|
Specifies the deployment type for Oracle NoSQL database. You can choose from the following options: - - - - - - |
Below are examples using Oracle NoSQL’s Document API and Key-Value API with MicroProfile Config.
Document API Example:
jnosql.document.provider=org.eclipse.jnosql.databases.oracle.communication.OracleDocumentConfiguration
jnosql.document.database=library
jnosql.oracle.nosql.host=http://localhost:8080
Key-Value API Example:
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.oracle.communication.OracleNoSQLKeyValueConfiguration
jnosql.keyvalue.database=library
jnosql.oracle.nosql.host=http://localhost:8080
Although these are the default configuration settings, you have the option to configure them programmatically. Create a class that implements Supplier<OracleNoSQLDocumentManager>
, annotate it with @Alternative
, and set the priority using @Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<OracleNoSQLDocumentManager> {
@Produces
public OracleNoSQLDocumentManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
OracleDocumentConfiguration configuration = new OracleDocumentConfiguration();
OracleDocumentManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
The OracleNoSQLRepository
interface extends the Repository interface and allows executing SQL queries using the @SQL
annotation. You can also combine it with the @Param
annotation for parameterized SQL queries:
@Repository
interface PersonRepository extends OracleNoSQLRepository<Person, String> {
@SQL("select * from Person")
List<Person> findAll();
@SQL("select * from Person where name = ?")
List<Person> findByName(@Param("") String name);
}
OrientDB is an open source NoSQL database management system written in Java. It is a multi-model database, supporting graph, document, key/value, and object models, but the relationships are managed as in graph databases with direct connections between records. It supports schema-less, schema-full and schema-mixed modes. It has a strong security profiling system based on users and roles and supports querying with Gremlin along with SQL extended for graph traversal.
This driver provides support for the Document NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-orientdb</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.OrientDBDocumentConfigurations
Configuration property | Description |
---|---|
|
The database host |
|
The user’s userID. |
|
The user’s password |
|
The storage type com.orientechnologies.orient.core.db.ODatabaseType |
This is an example using OrientDB’s Document API with MicroProfile Config.
jnosql.document.provider=org.eclipse.jnosql.databases.orientdb.communication.OrientDBDocumentConfiguration
jnosql.document.database=heroes
jnosql.orientdb.host=localhost:27017
jnosql.orientdb.user=root
jnosql.orientdb.password=rootpwd
jnosql.orientdb.storageType=plocal
The config settings are the default behavior; nevertheless, there is an option to do it programmatically. Create a class that implements the Supplier<OrientDBDocumentManager>
and then defines it as an @Alternative
and the Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<OrientDBDocumentManager> {
@Produces
public OrientDBDocumentManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
OrientDBDocumentConfiguration configuration = new OrientDBDocumentConfiguration();
OrientDBDocumentManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
The
interface is an extension of the OrientDBCrudRepository
interface that allows execution of a SQL Query via the Repository
annotation.@SQL
@Repository
interface PersonRepository extends OrientDBCrudRepository<Person, String> {
@SQL("select * from Person")
List<Person> findAll();
@SQL("select * from Person where name = ?")
List<Person> findByName(String name);
@SQL("select * from Person where age = :age")
List<Person> findByAge(@Param("age") Integer age);
}
The
interface is a specialization of the OrientDBTemplate
interface that allows execution of a SQL query and live query on both synchronous and asynchronous.DocumentTemplate
@Inject
OrientDBTemplate template;
...
Stream<Person> stream = template.sql("select * from Person where name = ?", "Ada");
template.live("select from Person where name = ?", callBack, "Ada");
RavenDB is a fully Transactional Open Source NoSQL Document Database. Easy to use, rapidly scalable, offers high availability, and takes your Business into the Next Generation of Data Performance.
This driver provides support for the Document NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-ravendb</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.RavenDBConfigurations
Configuration property | Description |
---|---|
|
The database host |
This is an example using RavenDB’s Document API with MicroProfile Config.
jnosql.document.provider=org.eclipse.jnosql.databases.ravendb.communication.RavenDBDocumentConfiguration
jnosql.document.database=heroes
Redis is a software project that implements data structure servers. It is open-source, networked, in-memory, and stores keys with optional durability.
This driver provides support for the Key-Value NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-redis</artifactId>
<version>1.1.3</version>
</dependency>
This is an example using Redis’s Key-Value API with MicroProfile Config. Please note that you can establish properties using the MicroProfile Config specification.
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.redis.communication.RedisConfiguration
jnosql.keyvalue.database=heroes
This API provides enum classes to programmatically establish the credentials as:
-
RedisConfigurations
for single node configuration# Single Node Configuration # by default the host is localhost jnosql.redis.host=localhost # by default the port is 6379 jnosql.redis.port=6379 # if you have user jnosql.redis.user=youruser # if you have password jnosql.redis.password=yourpassword
-
RedisSentinelConfigurations
for sentinel configuration# Sentinel Configuration jnosql.redis.sentinel.hosts=host1:26379,host2:26379 jnosql.redis.sentinel.master.name=masterName jnosql.redis.sentinel.master.user=masterUser jnosql.redis.sentinel.master.password=masterPassword #jnosql.redis.sentinel.master.ssl=false #jnosql.redis.sentinel.master.timeout=2000 #jnosql.redis.sentinel.master.connection.timeout=2000 #jnosql.redis.sentinel.master.socket.timeout=2000 jnosql.redis.sentinel.slave.user=slaveUser jnosql.redis.sentinel.slave.password=slavePassword #jnosql.redis.sentinel.slave.ssl=false #jnosql.redis.sentinel.slave.timeout=2000 #jnosql.redis.sentinel.slave.connection.timeout=2000 #jnosql.redis.sentinel.slave.socket.timeout=2000
-
RedisClusterConfigurations
for cluster configuration# Cluster Configuration jnosql.redis.cluster.hosts=host1:6379,host2:6379 jnosql.redis.cluster.user=clusterUser jnosql.redis.cluster.password=clusterPassword jnosql.redis.cluster.client.name=clusterClientName jnosql.redis.cluster.max.attempts=5 jnosql.redis.cluster.max.total.retries.duration=10000 #jnosql.redis.cluster.ssl=false #jnosql.redis.cluster.timeout=2000 #jnosql.redis.cluster.connection.timeout=2000 #jnosql.redis.cluster.socket.timeout=2000
This API provides the RedisConfigurations
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.
Configuration property | Description |
---|---|
|
The database host |
|
The database port |
|
The redis timeout, the default value is 2000 milliseconds |
|
The password’s credential |
|
The redis database number |
|
The cluster client’s name. The default value is 0. |
|
The value for the maxTotal configuration attribute for pools created with this configuration instance. The default value is 1000. |
|
The value for the maxIdle configuration attribute for pools created with this configuration instance. The default value is 10. |
|
The value for the minIdle configuration attribute for pools created with this configuration instance. The default value is 1. |
|
The value for the maxWait configuration attribute for pools created with this configuration instance. The default value is 3000 milliseconds. |
|
The connection timeout in milliseconds configuration attribute for the jedis client configuration created with this configuration instance. |
|
The socket timeout in milliseconds configuration attribute for the jedis client configuration with this configuration instance. |
|
The user configuration attribute for the jedis client configuration with this configuration instance. |
|
The ssl configuration attribute for the jedis client configuration with this configuration instance. The default value is false. |
|
The protocol configuration attribute for the jedis client configuration with this configuration instance. |
|
The clientset info disabled configuration attribute for the jedis client configuration with this configuration instance. The default value is false. |
|
The clientset info configuration libname suffix attribute for the jedis client configuration with this configuration instance. |
This API provides the RedisSentinelConfigurations
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.
Configuration Property | Description |
---|---|
|
The value for the sentinel HOST:PORT (separated by comma) configuration attribute for the jedis client configuration with this configuration instance. |
|
The value for the master name configuration attribute for the jedis client configuration with this configuration instance. |
|
The master client’s name, the default value is 0 |
|
The slave client’s name, the default value is 0 |
|
The master redis timeout, the default value is 2000 milliseconds |
|
The slave redis timeout, the default value is 2000 milliseconds |
|
The connection timeout in milliseconds configuration attribute for the master jedis client configuration created with this configuration instance. |
|
The connection timeout in milliseconds configuration attribute for the slave jedis client configuration created with this configuration instance. |
|
The socket timeout in milliseconds configuration attribute for the master jedis client configuration with this configuration instance. |
|
The socket timeout in milliseconds configuration attribute for the slave jedis client configuration with this configuration instance. |
|
The user configuration attribute for the master jedis client configuration with this configuration instance. |
|
The user configuration attribute for the slave jedis client configuration with this configuration instance. |
|
The password configuration attribute for the master jedis client configuration with this configuration instance. |
|
The password configuration attribute for the slave jedis client configuration with this configuration instance. |
|
The ssl configuration attribute for the master jedis client configuration with this configuration instance. The default value is false. |
|
The ssl configuration attribute for the slave jedis client configuration with this configuration instance. The default value is false. |
|
The protocol configuration attribute for the master jedis client configuration with this configuration instance. |
|
The protocol configuration attribute for the slave jedis client configuration with this configuration instance. |
|
The clientset info disabled configuration attribute for the master jedis client configuration with this configuration instance. The default value is false. |
|
The clientset info disabled configuration attribute for the slave jedis client configuration with this configuration instance. The default value is false. |
|
The clientset info configuration libname suffix attribute for the master jedis client configuration with this configuration instance. |
|
The clientset info configuration libname suffix attribute for the slave jedis client configuration with this configuration instance. |
This API provides the RedisClusterConfigurations
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.
Configuration Property | Description |
---|---|
|
The value for the sentinel HOST:PORT (separated by comma) configuration attribute for the jedis client configuration with this configuration instance. |
|
The cluster client’s name. The default value is 0. |
|
The cluster redis timeout, the default value is 2000 milliseconds |
|
The connection timeout in milliseconds configuration attribute for the cluster jedis client configuration created with this configuration instance. |
|
The socket timeout in milliseconds configuration attribute for the cluster jedis client configuration with this configuration instance. |
|
The user configuration attribute for the cluster jedis client configuration with this configuration instance. |
|
The password configuration attribute for the cluster jedis client configuration with this configuration instance. |
|
The ssl configuration attribute for the cluster jedis client configuration with this configuration instance. The default value is false. |
|
The protocol configuration attribute for the cluster jedis client configuration with this configuration instance. |
|
The clientset info disabled configuration attribute for the cluster jedis client configuration with this configuration instance. The default value is false. |
|
The clientset info configuration libname suffix attribute for the cluster jedis client configuration with this configuration instance. |
|
The value for the max attempts configuration attribute for the cluster jedis client configuration with this configuration instance. Default is 5. |
|
The value for the max total retries configuration attribute for the cluster jedis client configuration with this configuration instance. Default is 10000 milliseconds. |
The
is a specialization of the RedisBucketManagerFactory
that enables ranking and counter feature.BucketManagerFactory
@Inject
RedisBucketManagerFactory factory;
...
SortedSet game = factory.getSortedSet("game");
game.add("Otavio", 10);
game.add("Luiz", 20);
game.add("Ada", 30);
game.add(Ranking.of("Poliana", 40));
List<Ranking> ranking = game.getRanking();
Counter home = factory.getCounter("home");
Counter products = factory.getCounter("products");
home.increment();
products.increment();
products.increment(3L);
Using the same principle of the API you can inject using the @KeyValueDatabase
qualifier.
@Inject
@KeyValueDatabase("counter")
Counter counter;
@Inject
@KeyValueDatabase("game")
SortedSet game;
Riak (pronounced "ree-ack") is a distributed NoSQL key-value data store that offers high availability, fault tolerance, operational simplicity, and scalability. In addition to the open-source version, it comes in a supported enterprise version and a cloud storage version.
This driver provides support for the Key-Value NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-redis</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.RiakConfigurations
Configuration property | Description |
---|---|
|
The database host |
This is an example using Riak’s Key-Value API with MicroProfile Config.
jnosql.keyvalue.provider=org.eclipse.jnosql.databases.riak.communication.RiakKeyValueConfiguration
jnosql.keyvalue.database=heroes
Solr is an open-source enterprise-search platform, written in Java, from the Apache Lucene project. Its major features include full-text search, hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration, NoSQL features and rich document (e.g., Word, PDF) handling. Providing distributed search and index replication, Solr is designed for scalability and fault tolerance. Solr is widely used for enterprise search and analytics use cases and has an active development community and regular releases.
This driver provides support for the Document NoSQL API.
You can use either the Maven or Gradle dependencies:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-solr</artifactId>
<version>1.1.3</version>
</dependency>
This API provides the
class to programmatically establish the credentials.
Please note that you can establish properties using the MicroProfile Config specification.SolrDocumentConfigurations
Configuration property | Description |
---|---|
|
Database’s host. E.g.: jnosql.solr.host=http://localhost:8983/solr/ |
|
The user’s userID. |
|
The user’s password |
|
Define if each operation Apache Solr will commit automatically, true by default. |
This is an example using Solr’s Document API with MicroProfile Config.
jnosql.document.provider=org.eclipse.jnosql.databases.solr.communication.SolrDocumentConfiguration
jnosql.document.database=heroes
The config settings are the default behavior; nevertheless, there is an option to do it programmatically. Create a class that implements the Supplier<SolrDocumentManager>
and then defines it as an @Alternative
and the Priority
.
@ApplicationScoped
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<SolrDocumentManager> {
@Produces
public SolrDocumentManager get() {
Settings settings = Settings.builder().put("credential", "value").build();
SolrDocumentConfiguration configuration = new SolrDocumentConfiguration();
SolrDocumentManagerFactory factory = configuration.apply(settings);
return factory.apply("database");
}
}
The
interface is an extension of the SolrRepository
interface that allows using Solr query annotation that executes Solr query.Repository
@Repository
interface PersonRepository extends SolrRepository<Person, String> {
@Solr("select * from Person")
List<Person> findAll();
@Solr("select * from Person where name = $name")
List<Person> findByName(@Param("name") String name);
}
The
interface is a specialization of the SolrTemplate
that allows execution of a Solr query.DocumentTemplate
@Inject
SolrTemplate template;
...
List<Person> people = template.solr("age:@age AND type:@type AND _entity:@entity", params);
Currently, the Jakarta NoSQL doesn’t define an API for Graph database types but Eclipse JNoSQL provides a Graph template to explore the specific behavior of this NoSQL type.
Eclipse JNoSQL offers a mapping implementation for Graph NoSQL types:
<dependency>
<groupId>org.eclipse.jnosql.mapping</groupId>
<artifactId>jnosql-mapping-graph</artifactId>
<version>1.1.3</version>
</dependency>
Despite the other three NoSQL types, Eclipse JNoSQL API does not offer a communication layer for Graph NoSQL types. Instead, it integrates with Apache Tinkerpop 3.x.
@Inject
GraphTemplate template;
...
Category java = Category.of("Java");
Book effectiveJava = Book.of("Effective Java");
template.insert(java);
template.insert(effectiveJava);
EdgeEntity edge = template.edge(java, "is", software);
Stream<Book> books = template.getTraversalVertex()
.hasLabel("Category")
.has("name", "Java")
.in("is")
.hasLabel("Book")
.getResult();
Apache TinkerPop is database agnostic. Thus, you can change the database in your application with no or minimal impact on source code.
You can define the database settings using the MicroProfile Config specification, so you can add properties and overwrite it in the environment following the Twelve-Factor App.
jnosql.graph.provider=<CLASS-DRIVER>
jnosql.provider.host=<HOST>
jnosql.provider.user=<USER>
jnosql.provider.password=<PASSWORD>
Tip
|
The property is necessary when you have more than one driver in the classpath. Otherwise, it will take the first one.
|
These configuration settings are the default behavior. Nevertheless, there is an option to programmatically configure these settings. Create a class that implements the
, then define it using the Supplier<Graph>
and @Alternative
annotations.@Priority
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
public class ManagerSupplier implements Supplier<Graph> {
@Produces
public Graph get() {
Graph graph = ...; // from a provider
return graph;
}
}
You can work with several document database instances through CDI qualifier. To identify each database instance, make a Graph
visible for CDI by putting the
and the @Produces
annotations in the method.@Database
@Inject
@Database(value = DatabaseType.GRAPH, provider = "databaseA")
private GraphTemplate templateA;
@Inject
@Database(value = DatabaseType.GRAPH, provider = "databaseB")
private GraphTemplate templateB;
// producers methods
@Produces
@Database(value = DatabaseType.GRAPH, provider = "databaseA")
public Graph getManagerA() {
return manager;
}
@Produces
@Database(value = DatabaseType.GRAPH, provider = "databaseB")
public Graph getManagerB() {
return manager;
}
Eclipse JNoSQL does not provide Apache Tinkerpop 3 dependency; check if the provider does. Otherwise, do it manually.
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>jnosql-gremlin-core</artifactId>
<version>${tinkerpop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>jnosql-gremlin-groovy</artifactId>
<version>${tinkerpop.version}</version>
</dependency>
Having trouble with Eclipse JNoSQL databases? We’d love to help!
Please report any bugs, concerns or questions with Eclipse JNoSQL databases to https://github.com/eclipse/jnosql. Follow the instructions in the templates and remember to mention that the issue refers to JNoSQL databases.
We are very happy you are interested in helping us and there are plenty ways you can do so.
-
Open an Issue: Recommend improvements, changes and report bugs. Please, mention that the issue refers to the JNoSQL databases project.
-
Open a Pull Request: If you feel like you can even make changes to our source code and suggest them, just check out our contributing guide to learn about the development process, how to suggest bugfixes and improvements.
The integration tests on databases primarily integrate with the Testcontainers, requiring a more powerful computer.
Those tests are disabled by default; thus, if you want to run only the integration tests:
mvn test -Djnosql.test.integration=true
To create integration tests on this project, we’re using EnabledIfSystemProperty from JUnit Jupiter, where the system property is: jnosql.test.integration
, and we expected true
to execute.
We, the IntegrationTest
structure class, hold this content, considering using it on the new integration tests.
import static org.eclipse.jnosql.communication.driver.IntegrationTest.NAMED;
import static org.eclipse.jnosql.communication.driver.IntegrationTest.MATCHES;
@EnabledIfSystemProperty(named = NAMED, matches = MATCHES)
class IntegrationSampleTest {
}
As an open-source project, you’re free to create any driver, and you’re welcome to join and participate in the process. To add a new driver, we have a few requirements:
-
Run Java 17
-
Include the documentation driver in the README file.
-
Cover the driver with tests and preferences with TestContainer.
-
Please pay attention to the documentation. This includes JavaDoc
-
Include a class to represent and contain the properties. In general, those are
enum
-
A nomenclature is the <DATABASE>Configurations, e.g., CassandraConfigurations, MongoDBConfigurations.
-
The package name will follow the terminology:
org.jnosql.databases.[DATABASE].[LAYER]
-
E.g., Give a database called "Ada" that is a column type, the package name will be:
org.eclipse.jnosql.databases.ada.communication
for the driver layer andorg.eclipse.jnosql.databases.ada.mapping
for the mapping. -
You can include the database in a single project if a NoSQL supports multiple database types.
-
-
-
It is crucial to have an integration test with the database; please annotate those
EnabledIfSystemProperty
and check the integration session to know more. -
Create a
Supplier
class on the mapping layer that will produce a specific Manager instance using Microprofile. Check:ColumnManagerSupplier
,DocumentManagerSupplier
classes to get more information.
Eclipse JNoSQL uses Apache Tinkerpop for Graph API. Using this API gives support to over twenty fives databases.