What's New In Eclipse JNoSQL 0.0.6

DZone 's Guide to

What's New In Eclipse JNoSQL 0.0.6

Read this article in order to learn more about what's new in the release of Eclipse JNoSQL 0.0.6.

· Database Zone ·
Free Resource

Eclipse JNoSQL is a framework that makes the integration between Java and NoSQL easier with an extensible API that allows both to use common features as standards calls and expandable enough to allow to use particular features from any specific vendor. The version 0.0.6 comes with the hot query as text. This post will cover this release.

The hottest release at this version was the query by String, explained here. This feature creates a text query that uses the standard API. Briefly, it converts the text query to a method at an entity manager.

Image title

So beyond the Graph, that already has gremlin as Graph query, each NoSQL database type API has a specific query.

DocumentTemplate documentTemplate = ..;
ColumnTemplate columnTemplate = ...;
KeyValueTempalte keyValueTemplate =...;
GraphTemplate graphTemplate =...;
List<Movie> movies = documentTemplate.query("select * from Movie where year > 2012");
List<Person> people = columnTemplate.query("select * from Person where id = 12");
Optional<God> god = keyValueTemplate.query("get \"Diana\"");
List<City> cities = graphTemplate.query("g.V().hasLabel('City')");

To run a query dynamically, use the prepare method. It will return a PreparedStatement interface. To define a parameter to key-value, document, and column query, use the "@" in front of the name.

PreparedStatement preparedStatement = documentTemplate.prepare("select * from Person where name = @name");
preparedStatement.bind("name", "Ada");
List<Person> adas = preparedStatement.getResultList();
//to graph just keep using gremlin
PreparedStatement prepare = graphTemplate().prepare("g.V().hasLabel(param)");
prepare.bind("param", "Person");
List<Person> people = preparedStatement.getResultList();


The Repository interface contains all the trivial methods shared among the NoSQL implementations that a developer does not need to care about. Also, there is query method that does a query based on the method name. The next version brought two new annotations: the Query and param that defines the statement and set the values in the query respectively.

 interface PersonRepository extends Repository<Person, Long> {
        @Query("select * from Person")
        Optional<Person> findByQuery();
        @Query("select * from Person where id = @id")
        Optional<Person> findByQuery(@Param("id") String id);

Remember, when a developer defines who that repository will be implemented from, the CDI qualifier, the query will be executed to that defined type, eg. gremlin to Graph, JNoSQL key to key-value, and so on.

@Database(value = DatabaseType.COLUMN)
private PersonRepository repository;


This article covered how a Java developer can make a smooth integration between Java and NoSQL with Eclipse JNoSQL. At this version, query as the text was the most expected feature. This feature allows a single consult in the database. However, that does forget the particular query that each NoSQL provider has. It is important to point out the focus of the frameworks is to make the integration easier, but the NoSQL about the database is still required. To the next step, more databases are expected and also the possibility to create the API and get it in in the Jakarta EE process, despite the need to wait for the EE4P specification process.

Click here to learn more about this version.

database, eclipse, java, javaee, jnosql, nosql, open source

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}