DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Handling Embedded Data in NoSQL With Java
  • Simplify NoSQL Database Integration in Java With Eclipse JNoSQL 1.1.3
  • Understanding Polyglot Persistence
  • Building a REST Application With Oracle NoSQL Using Helidon

Trending

  • Slopsquatting: Building a Scanner That Catches AI-Hallucinated Packages Before They Reach Production
  • The Invisible OOMKill: Why Your Java Pod Keeps Restarting in Kubernetes
  • Mocking Kafka for Local Spring Development
  • Pragmatica Aether: Let Java Be Java
  1. DZone
  2. Coding
  3. Java
  4. Jakarta NoSQL 1.0: A Way To Bring Java and NoSQL Together

Jakarta NoSQL 1.0: A Way To Bring Java and NoSQL Together

Jakarta NoSQL 1.0 standardizes NoSQL integration in Java with familiar annotations, a fluent API, and support for multiple NoSQL types—boosting productivity, portability.

By 
Otavio Santana user avatar
Otavio Santana
DZone Core CORE ·
Mar. 26, 25 · Analysis
Likes (5)
Comment
Save
Tweet
Share
9.2K Views

Join the DZone community and get the full member experience.

Join For Free

NoSQL is no longer the exception — it's a key part of modern data architectures. With the release of Jakarta NoSQL 1.0, Java developers finally gain a standardized, extensible way to interact with NoSQL databases across document, key-value, column, and graph data models — all while staying aligned with Jakarta EE principles.

This article introduces the Jakarta NoSQL 1.0 specification, which boosts productivity, simplifies mapping, and provides fluent, type-safe access to NoSQL data.

The Goal: Simplifying Java-NoSQL Integration

Jakarta NoSQL is the first specification in the Jakarta EE ecosystem designed to integrate Java applications with NoSQL technologies in a portable and standard way.

The specification was built with a few core goals in mind:

  • Increase developer productivity when working with NoSQL databases
  • Enable annotation-driven, rich object mapping similar to Jakarta Persistence
  • Provide a Java-based query and fluent API for seamless database operations

Annotation-Based Mapping

One of Jakarta NoSQL's core strengths is its annotation model, which borrows familiar concepts from Jakarta Persistence (JPA). This means that developers already familiar with JPA can get started quickly.

The key annotations include:

Annotation Description
@Entity Marks a class as persistable
@Id Defines the primary key
@Column Maps fields or properties
@Embeddable, @MappedSuperclass Enable composition and inheritance
@Convert Defines how to persist custom types


Here’s a basic example of a Car entity:

Java
 
@Entity
public class Car {

    @Id
    private Long id;

    @Column
    private String name;

    @Column
    private CarType type;

    // Getters and setters...
}


Note: Jakarta NoSQL intentionally does not define relationship mappings such as @OneToMany or @ManyToOne Due to the nature of NoSQL models, implementations can offer such extensions when the database supports them.

The Template Interface: A Unified Data Bridge

Jakarta NoSQL introduces the Template interface to connect Java entities with NoSQL databases. Through this interface, you can perform standard CRUD operations and fluent queries with a consistent API.

Basic operations look like this:

Java
 
@Inject
Template template;

Car car = Car.id(1L)
             .name("Ferrari")
             .type(CarType.SPORT);

template.insert(car);

Optional<Car> result = template.find(Car.class, 1L);
template.delete(Car.class, 1L);


Querying With Fluent API

In addition to essential persistence, the Template Interface offers a fluent querying API, making NoSQL access expressive and type-safe:

Java
 
List<Car> cars = template.select(Car.class)
                         .where("type").eq(CarType.SUV)
                         .orderBy("name").asc()
                         .result();

template.delete(Car.class)
        .where("type").eq(CarType.COUPE)
        .execute();


This abstraction makes it easy to express filters, sort orders, and actions without writing vendor-specific query syntax.

Extensibility and Implementation

Jakarta NoSQL is extensible by design. While the spec defines the standard behavior, NoSQL providers can add their specific capabilities through extensions, including custom queries, transactions, or even relationship support.

The reference implementation, Eclipse JNoSQL, offers:

  • Full support for Jakarta NoSQL annotations and templates
  • Integration with CDI and CDI Lite
  • Annotation processors to reduce reflection usage in native or cloud environments

Tooling support is also available via IntelliJ IDEA plugins to recognize entities and fields.

Supporting Jakarta NoSQL

Supporting Jakarta NoSQL


Trade-Offs of Using Jakarta NoSQL

While Jakarta NoSQL brings a welcome level of standardization and consistency to the Java-NoSQL landscape, it’s essential to understand the trade-offs involved when adopting this specification:

Pros

  • Familiar programming model. Developers already using Jakarta Persistence (JPA) will find the annotation model intuitive and easy to adopt.
  • Portability. The abstraction allows you to switch between NoSQL databases with minimal code changes.
  • Extensibility. Vendors can provide extensions for advanced or database-specific behavior, enabling the API to grow with your needs.
  • Integration with Jakarta EE. Fits naturally into Jakarta EE projects using CDI, making it a first-class citizen in the enterprise Java world.
  • Improved developer productivity. Rich object mapping and fluent query APIs simplify the learning curve and reduce boilerplate.

Cons and Limitations

  • Abstraction overhead. The API's generic nature may hide database-specific features, limiting access to native capabilities unless you use vendor extensions.
  • No relationship support by default. Unlike JPA, there’s no built-in support for entity relationships (like @ManyToOne), as many NoSQL databases don’t support joins. This can lead to more manual modeling and denormalized data.
  • Learning curve for NoSQL modeling. Developers coming from relational backgrounds might need to adapt to different modeling approaches, especially in document and graph databases.
  • Performance tuning limitations. Optimizing queries might require dropping down to native APIs when you need fine-grained control, which can reduce portability.

In summary, Jakarta NoSQL offers an elegant, standardized path for integrating Java with NoSQL, but like any abstraction, it requires thoughtful consideration when choosing between portability and database-specific optimization.

Conclusion

Jakarta NoSQL 1.0 fills a long-standing gap in the Java ecosystem, offering a standard, vendor-neutral way to work with NoSQL technologies using Jakarta EE patterns. Whether you're building cloud-native microservices or evolving legacy systems toward modern data models, Jakarta NoSQL provides a foundation on which to grow.

If you're a Java developer already using NoSQL, Jakarta NoSQL makes your work more portable and productive. And if you're considering transitioning from relational to NoSQL, this spec provides a familiar and consistent path forward.

You can explore the full specifications here.

Further Reading

  • Eclipse JNoSQL Project
  • Jakarta EE Specifications
API Database NoSQL Java (programming language)

Opinions expressed by DZone contributors are their own.

Related

  • Handling Embedded Data in NoSQL With Java
  • Simplify NoSQL Database Integration in Java With Eclipse JNoSQL 1.1.3
  • Understanding Polyglot Persistence
  • Building a REST Application With Oracle NoSQL Using Helidon

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook