Using NoSQL Databases With Jakarta EE and MicroProfile

Share
  • November 22, 2021

With the evolution of Jakarta EE and the trend towards NoSQL databases, it’s the ideal time for every Java developer to learn more about the Eclipse JNoSQL project.

Eclipse JNoSQL is a Java framework that makes it easier to integrate Jakarta EE and MicroProfile applications with NoSQL databases. To help explain the JNoSQL functionality and why Java developers should adopt the technology, we asked Otavio Santana, one of the JNoSQL project leads, to answer a few questions.

JAXenter: Why are developers increasingly using NoSQL databases?

Otavio Santana: With a NoSQL database, developers can do things that are similar to what they can do in an SQL relational database when it comes to information storage, but it’s typically easier to horizontally scale the database.

NoSQL databases give developers the flexibility to choose the optimal storage format for the data they’re working with. SQL databases usually all have the same structure, whereas NoSQL databases are available with different data models: key-value, wide column, document, and graph. Developers can choose from more than 200 implementations of NoSQL databases across these data model types.

Most NoSQL databases are highly scalable, which means they’re often a good choice for data sets that are very large and that change frequently — two factors that come up quite often in today’s data-driven world. For example, NoSQL databases have become very popular in industries such as finance where they’re heavily used by several banks.

SEE ALSO: “Organizations have to focus on smart security”

JAXenter: Why is the Eclipse JNoSQL technology needed?

Otavio Santana: With so many different NoSQL databases to choose from, developers may want to switch from one implementation to another. However, making the switch means learning a new API, which is time-consuming. As a result, developers can find themselves locked into the NoSQL database they first chose.

With Eclipse JNoSQL, Java developers can easily switch between NoSQL database implementations. They can do this because JNoSQL provides a set of APIs that interact with the NoSQL database and a standard implementation for quite a number of NoSQL databases. The Jakarta NoSQL specification enables a very low level of coupling between the application and the underlying NoSQL database.

JAXenter: At a high level, how does the Eclipse JNoSQL technology work?

Otavio Santana: JNoSQL provides a repository approach, which means Java developers write the interface and the specification handles the implementation.

The JNoSQL technology is comprised of two layers:

  • A communication layer with an API module for each of the four NoSQL database types.
  • A mapping layer that uses technologies including Jakarta Contexts and Dependency Injection (CDI) and Jakarta Bean Validation to allow developers to integrate their Java applications with the NoSQL database. The architecture of the mapping layer means JNoSQL can be used with Jakarta EE and with MicroProfile, which also incorporates CDI.

JNoSQL also includes a number of features that make it easy to use. For example, developers can write a method query and the technology will translate it into a named query.

JAXenter: How many NoSQL databases can I use JNoSQL to switch between?

Otavio Santana: You can use JNoSQL to switch between about 30 popular NoSQL databases, including MongoDB, Apache Cassandra, Apache HBase, RADIUS, and Neo4j.

For example, if you’re using MongoDB, which is a document database, and you want to switch to ArangoDB, which is another document database, you can simply replace the driver instead of learning a new database API.

JAXenter: What’s the current status of the JNoSQL project?

Otavio Santana: The Jakarta NoSQL specification is the first new specification to be added to Jakarta EE since it transitioned to the Eclipse Foundation. Our goal is to have the first release of the specification available in Jakarta EE 11, but we’re dependent on Jakarta Config, so that specification needs to be updated and available before we can finalize our specification.

We depend on Jakarta Config for configuration capabilities such as credentials, which are needed for the connection between the Java application and the NoSQL database. We felt it was better to reuse the existing standard than to reinvent the wheel.

SEE ALSO: How GitOps Offers a Direct Path to Self-Service for Developers

JAXenter: Can developers start using the JNoSQL technology now?

Otavio Santana: Yes, absolutely. In fact, there’s already a major IoT player in Brazil using the JNoSQL technology in a production environment. They’re using JNoSQL to move their Java EE application to Jakarta EE 8 and a microservices architecture.

We invite everyone who’s interested to test the technology, provide feedback, and report bugs. To introduce yourself and let us know how you can help, join the JNoSQL mailing list.

For more information about JNoSQL and how it works:

The post Using NoSQL Databases With Jakarta EE and MicroProfile appeared first on JAXenter.

Source : JAXenter