Code Monkey home page Code Monkey logo

nosql's Introduction

Jakarta NoSQL

Jakarta NoSQL logo

Introduction

Jakarta NoSQL is a comprehensive framework designed to simplify the integration of Java applications with various NoSQL databases. By providing a unified API and a set of powerful annotations, Jakarta NoSQL enables developers to seamlessly work with different NoSQL data stores while maintaining flexibility and productivity.

Goals

  • Increase productivity performing common NoSQL operations.

  • Rich Object Mapping integrated.

  • Java-based Query and Fluent-API.

  • It is designed to work with various NoSQL databases and can quickly adapt to support new types and behaviors through extensions.

  • Annotation-oriented using Jakarta Persistence-like naming when it makes sense

One Mapping API to Multiples NoSQL Databases

Jakarta NoSQL provides one API for each NoSQL database type. However, it incorporates the same annotations from the Jakarta Persistence specification and heritage Java Persistence Architecture (JPA) to map Java objects. Therefore, with just these annotations that look like JPA, there is support for more than twenty NoSQL databases.

@Entity
public class Car {

    @Id
    private Long id;
    @Column
    private String name;
    @Column
    private CarType type;
 //...
}

Annotations

The annotations from the Mapping API will look familiar to Jakarta Persistence developers:

Annotation

Description

@Entity

Specifies that the class is an entity. This annotation is applied to the entity class.

@Id

Specifies the primary key of an entity.

@Column

Specifies the mapped column for a persistent property or field.

@MappedSuperclass

Specifies a class whose mapping information is applied to entities that inherit from it.

@Embeddable

Declares a class whose instances are stored as an intrinsic part of an owning entity, sharing the identity of the entity.

@Inheritance

Specifies the inheritance mapping strategy for the entity class hierarchy.

@DiscriminatorColumn

Specifies the discriminator column for the mapping strategy.

@DiscriminatorValue

Specifies the value of the discriminator column for the annotated entity type.

@Convert

Specifies how the values of a field or property are converted to a basic type or a type that can be persisted by a persistence provider.

These annotations provide a powerful toolkit for defining and mapping entities in NoSQL databases, analogous to their counterparts in Jakarta Persistence.

Template

After mapping an entity, you can explore the advantage of using a Template interface, which can increase productivity on NoSQL operations.

@Inject
Template template;
...

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

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

The Template interface provides specialized methods to leverage the features of specific NoSQL database types.

Maven dependency

<dependency>
    <groupId>jakarta.nosql</groupId>
    <artifactId>jakarta.nosql-api</artifactId>
    <version>1.0.0-b7</version>
</dependency>

More Information

To learn more, please refer to the reference documentation, and JavaDocs.

Code of Conduct

This project is governed by the Eclipse Foundation of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to [email protected].

Getting Help

Having trouble with Jakarta NoSQL? We’d love to help!

Please report any bugs, concerns or questions with Jakarta NoSQL to https://github.com/eclipse-ee4j/nosql.

Building from Source

You don’t need to build from source to use the project, but should you be interested in doing so, you can build it using Maven and Java 17 or higher.

mvn clean install

nosql's People

Contributors

dansilva41 avatar dearrudam avatar dmitrigit avatar jesse-gallagher avatar keilw avatar leomrlima avatar mpredli01 avatar otaviojava avatar roanbrasil avatar robsonkades avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nosql's Issues

Should we move the default implementation of communication?

On Jakarta NoSQL, we have two layers where the communication layer is mostly data structure, which might only change sometimes.

Should we define the default communication on Jakarta NoSQL?

Thus, we move the JNoSQL communication where we can keep the focus on both the mapping layer and the database drivers.

Add support to Inheritance

Inheritance is a fundamental concept of object-oriented programming and Java. NoSQL, usually, has no concept of inheritance, so persisting inheritance in a database can be tricky. Because databases have no concept of inheritance, there is no standard way of implementing inheritance in a database, so the hardest part of persisting inheritance is choosing how to represent the inheritance in the database.

The proposal to Jakarta NoSQL is to use a similar approach that JPA single table did.

Single table

Single table inheritance is the simplest and typically the best performing and best solution. In single table inheritance, a single table is used to store all of the instances of the entire inheritance hierarchy. The table will have a column for every attribute of every class in the hierarchy. A discriminator column is used to determine which class the particular row belongs to, each class in the hierarchy defines its own unique discriminator value.

Example

This example will use Notification:
notification

Code

@Entity
@Inheritance
@DiscriminatorColumn(name="type")
public abstract class Notification {
    @Id
    private Long id;

    @Column
    private String name;

    @Column
    private LocalDate createdOn;

    public abstract void send();
}

@Entity
@DiscriminatorValue("SMS")
public class SmsNotification extends Notification {

    @Column
    private String phoneNumber;

    @Override
    public void send() {
        System.out.println("Sending message to sms: " + phoneNumber);
    }
}



@Entity
@DiscriminatorValue("EMAIL")
public class SmsNotification extends Notification {

    @Column
    private String phoneNumber;

    @Override
    public void send() {
        System.out.println("Sending message to sms: " + phoneNumber);
    }
}

@Entity
public class EmailNotification extends Notification {
    @Column
    private String email;

    @Override
    public void send() {
        System.out.println("Sending message to email: " + email);
    }
}

This annotation will work with: Document, Column and Graph, but we won't have support to key-value.

Possible new logo

I was wondering, since there are so many references to gods and godesses mostly from ancient Greek mythology how do you find the idea of a Jakarta EE (color) themed variation of Odysseus' ship? Something like https://pexels-library.com/img/odysseus-clipart-24.html (it says share or modify) could be a basis or others like this one https://www.dreamstime.com/stock-illustration-greek-trireme-stylized-illustration-ancient-ship-image42935054 (even got an orange sail already)

Others like https://www.vectorstock.com/royalty-free-vector/greek-boat-odyssey-argonauts-for-greece-travel-vector-15882901
or slightly more abstract shapes
https://www.vectorstock.com/royalty-free-vector/greek-ancient-ship-vector-18459891
and
https://www.vectorstock.com/royalty-free-vector/greek-ancient-ship-vector-24682536
(again with an orange sail)

Maybe someone comes up with a different idea, but as Jakarta EE generally has the sail boat image, I thought it could be a nice way to use that CI and theme for NoSQL.

The Jakarta NoSQL's future

Following the previous feedback from the program committee:

We don't have a problem with the spec exploring this direction, but we currently have no interest in incorporating this in any profile or the platform. We'd also want to see interest and active work in a second implementation before this spec would be proposed final.

jakartaee/specifications#506 (comment)

They don't plan to move it forward as part of the Jakarta EE platform; on the other hand, we have Jakarta Data as a WIP specification that takes considerable effort to make happen.

Given this scenario, what do you think the best strategy for Jakarta NoSQL is?

I thought of some options:

  • Think about moving to the Eclipse Microprofile side
  • Returns the efforts to focus on JNoSQL (as a library that implements Jakarta Data) and hold Jakarta NoSQL for a while.
  • Find a second implementation for Jakarta NoSQL (which company?)
  • Reduce the Jakarta NoSQL scope for only mapping annotations. It makes it easier for more implementations and vendors.

Another option, I'm open to suggestions.

Provide module-infos

NoSQL is pretty well modularized, but so far those modules rely on automatic module-names. In correlation with a Jakarta EE naming scheme for Jigsaw modules, NoSQL should define actual modules in module-info files.

Make spec document more implementor centric

Going through current spec, it feels to me more like a user-guide for particular implementation.
While having descriptive examples may be good thing to have there, I'd expect the spec document to be more "implementor centric" with defined requirements for the implementor. A user guide of particular implementation seems to be better place for (more) detailed examples as it may use also implementation-specific features.

Include select and delete methods on Document and Column template specializations

Currently, we have two query instances for both Document and Column types.

The proposal is to increase the experience by adding two methods on both Document and Column templates.

@Inject
DocumentTemplate template;

List<Book> books = template.select(Book.class).where("category").eq("Java").execute();

template.delete(Person.class).where("id").eq("id").execute();

Both will work with the fluent query API style.

Missing operators in DocumentCondition

Hi @otaviojava
Let's keep track of the missing operators / functionalities to extend yours DocumentCondition (#90) with :

  1. 'Not' operator. Basic negation operator, I believe every nosql databases supports it (for sure it's supported by MongoDB and ElasticSearch).

  2. InclusiveBetween + ExclusiveBetween VS Between. Same as before, also we already talked about this.

  3. Allowing a 'path' on the 'Right hand side'. This is the hardest one, we need to find a way to represent a 'path' and allowing DocumentCondition operators to accept that path as a RHS. For example this allows making queries like 'retrieve every movie where critics score is higher than odience score'. You told me this is not supported at the moment so we need to work on this. If I recall correctly, both mongodb and elasticsearch support this out of the box.

What do you think ?

Update Jakarta NoSQL API to Java 17

Currently, the Jakarta NoSQL specification uses Java 11 API. However, the main goal of Jakarta EE 11 is to use the latest LTS (Long-Term Support) version of Java. Therefore, we need to update the Jakarta NoSQL API to Java 17 to keep up with the latest version of Java.

To achieve this goal, we need to update the POM.xml file to specify the Maven version that supports Java 17. Additionally, we should remove the Java 11 GitHub action and replace it with a Java 17 action.

This issue is an excellent opportunity for the first contribution to Jakarta NoSQL specification. We encourage the community to help us update the API to Java 17.

Tasks:

  • Update POM.xml to specify Maven version that supports Java 17.
  • Remove Java 11 GitHub action.
  • Add Java 17 GitHub action.

Note: The goal of Jakarta EE 11 is to use the latest Java LTS release, which is Java 17. We should aim to use Java 17 to keep the Jakarta NoSQL specification up-to-date.

ReactiveStreams/Flow support

almost all data related project, such as Spring Data, MicroauntData have added ReactiveStreams/Flow support, Jakarta EE/MP also includes a ReactiveStreams operates spec.

Consider ReactiveStreams or Java Flow support.

PrePersist & PostPersist events

Hi there,
first of all I want to thank you for all this wonderfull work.
Nosql was the kind of specification/abstraction Jakarta EE needed and I think that all of this (beginning with the 4 different kind of nosql interfaces) is a stroke of genius.

Let's get into business:

  1. There is a typo :
    jakarta.nosql.mapping.EntityPostPersit
    should be
    jakarta.nosql.mapping.EntityPostPersist

  2. I believe using interfaces to manage PrePersist & PostPersist events is a mistake.
    JPA uses annotations :
    javax.persistence.PrePersist
    javax.persistence.PostPersist

Why annotations are better ?
Imagine you have a hierarchy of MappedSuperclass, if you override EntityPrePersist methods you have to pay attention to call super implementations.
This is prone error, you may just want to "do things" in every MappedSuperclass without knowing such interfaces were already implemented.

Please consider using annotations like jpa and scanning every method (in the whole hierarchy) and call each of them to handle prepersist and post persist events :

package jakarta.nosql.mapping;

import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Specifies a callback method for the corresponding 
 * lifecycle event. This annotation may be applied to methods 
 * of an entity class or a mapped superclass.
 *
 * @since 1.0
 */
@Target({METHOD}) 
@Retention(RUNTIME)

public @interface PrePersist {}

and

package jakarta.nosql.mapping;

import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Specifies a callback method for the corresponding 
 * lifecycle event. This annotation may be applied to methods 
 * of an entity class or a mapped superclass.
 *
 * @since 1.0
 */
@Target({METHOD}) 
@Retention(RUNTIME)

public @interface PostPersist {}

Trying to implement at OpenLiberty

Hello everyone

I'm trying to implement jakarta nosql in openliberty, but i dont have success.
Dependencies are not resolved, and package jakarta.nosql.* dont exist.
The openLiberty version is 21.0.0.2

Any help is apreciated. Regards

The pom.xml used is:

<modelVersion>4.0.0</modelVersion>
<groupId>com.module</groupId>
<artifactId>module</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>

<properties>
    <maven.compiler.source>15</maven.compiler.source>
    <maven.compiler.target>15</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<dependencies>
	<!-- https://mvnrepository.com/artifact/jakarta.platform/jakarta.jakartaee-web-api -->
	<dependency>
	    <groupId>jakarta.platform</groupId>
	    <artifactId>jakarta.jakartaee-web-api</artifactId>
	    <version>8.0.0</version>
	    <scope>provided</scope>
	</dependency>
    <!-- https://mvnrepository.com/artifact/org.eclipse.microprofile/microprofile -->
    <dependency>
        <groupId>org.eclipse.microprofile</groupId>
        <artifactId>microprofile</artifactId>
        <version>4.0.1</version>
        <type>pom</type>
        <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.jnosql.diana/diana-document -->
<dependency>
	    <groupId>org.jnosql.diana</groupId>
	    <artifactId>diana-document</artifactId>
	    <version>0.0.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jnosql.diana/mongodb-driver -->
<dependency>
	    <groupId>org.jnosql.diana</groupId>
	    <artifactId>mongodb-driver</artifactId>
	    <version>0.0.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jnosql.artemis/artemis-configuration -->
<dependency>
	    <groupId>org.jnosql.artemis</groupId>
	    <artifactId>artemis-configuration</artifactId>
	    <version>0.0.9</version>
	    <scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jnosql.artemis/artemis-document -->
<dependency>
     	    <groupId>org.jnosql.artemis</groupId>
	    <artifactId>artemis-document</artifactId>
	    <version>0.0.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.18</version>
        <scope>provided</scope>
    </dependency>
	<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
	<dependency>
	    <groupId>com.google.code.gson</groupId>
	    <artifactId>gson</artifactId>
	    <version>2.8.6</version>
	</dependency>
</dependencies>

<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
    	<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-war-plugin -->
		<plugin>
		    <groupId>org.apache.maven.plugins</groupId>
		    <artifactId>maven-war-plugin</artifactId>
		    <version>3.3.1</version>
		</plugin>
        <!-- https://mvnrepository.com/artifact/io.openliberty.tools/liberty-maven-plugin -->
		<plugin>
		    <groupId>io.openliberty.tools</groupId>
		    <artifactId>liberty-maven-plugin</artifactId>
		    <version>3.3.4</version>
		</plugin>
    </plugins>
</build>

Add CI support for Java 20

As discussed in today's meeting, Mar 29, we need to support the latest LST, Java 17, and be ready for the next LST version, Java 21.

This issue will create a GitHub Action, CI, to run the source code against Java 20; this won't impact the code behavior.
It is an excellent issue to the first contribution.

To-Do:

  • Create a GitHub Action that runs the Jakarta NoSQL source code against Java 20
  • Test the Action and ensure it correctly detects any compatibility issues
  • Update the README to document the new CI support for Java 20

Create a TCK

Either in a separate repository (as many Jakarta EE specs do) or theoretically as a module (then #15 would become mandatory to tell API and TCK apart) here we should create a TCK soon.

Eventual consistency issues during TCK execution against jnosql-elasticsearch-driver

@otaviojava could you help me with it?

After the bigbang update, I've tried to contribute again with the jnosql-elasticsearch-driver project by setting up the TCK driver-tck-document into the POM in order to run their tests.

The tests have failed as we can see down below:

[ERROR] Tests run: 19, Failures: 3, Errors: 0, Skipped: 4, Time elapsed: 0.598 s <<< FAILURE! - in jakarta.nosql.tck.communication.driver.document.DocumentManagerTest
[ERROR] shouldSelect{DocumentArgument}[1]  Time elapsed: 0.167 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <1> but was: <0>
        at jakarta.nosql.tck.communication.driver.document.DocumentManagerTest.shouldSelect(DocumentManagerTest.java:251)

[ERROR] shouldSingleResult{DocumentArgument}[1]  Time elapsed: 0.015 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
        at jakarta.nosql.tck.communication.driver.document.DocumentManagerTest.shouldSingleResult(DocumentManagerTest.java:277)

[ERROR] shouldReturnAnErrorEmptySingleResult{DocumentArgument}[1]  Time elapsed: 0.025 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: Expected jakarta.nosql.NonUniqueResultException to be thrown, but nothing was thrown.
        at jakarta.nosql.tck.communication.driver.document.DocumentManagerTest.shouldReturnAnErrorEmptySingleResult(DocumentManagerTest.java:299)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   DocumentManagerTest.shouldReturnAnErrorEmptySingleResult:299 Expected jakarta.nosql.NonUniqueResultException to be thrown, but nothing was thrown.
[ERROR]   DocumentManagerTest.shouldSelect:251 expected: <1> but was: <0>
[ERROR]   DocumentManagerTest.shouldSingleResult:277 expected: <true> but was: <false>
[INFO] 
[ERROR] Tests run: 43, Failures: 3, Errors: 0, Skipped: 4
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  48.853 s
[INFO] Finished at: 2023-01-07T21:27:13-03:00
[INFO] ------------------------------------------------------------------------

It makes me learn more about the Elasticsearch indexing process. Such process is an asynchronous process, it means, the server responses for index requests acts like an ACK signal meaning that the sent document will be indexed in another time. Such behavior causes eventual inconsistencies during the TCK test executions.

In the jnosql-elasticsearch-driver project, the tests are using the Awaitility library to handle this situation. After any document insert or update request, the execution awaits a little bit to be resumed, making sure the documents were stored or updated.

Maybe, we should use the same strategy on the TCK driver-tck-document. I could work on it!

@otaviojava what do you think about that?

How to handle ElementCollection

In JPA there is ElementCollection to embed a collection of embeddable elements in the Entity, if possible add such a feature in NoSQL.

Improving of the first Chapters' introduction content.

Hi Team,

I think that introduction of the first Chapter ("One Mapping API, multiples databases") has some redundant information that, when removed, will improve comprehension of the content. Now the begining of the introduction is:

"Jakarta NoSQL is a Java framework that streamlines the integration of Java applications with NoSQL databases. It defines a set of APIs and provides a standard implementation for most NoSQL databases. This clearly helps to achieve very low application coupling with the underlying NoSQL technologies used in applications.

The project has two layers that define communication with NOSQL databases through API’s. There are:

Communication Layer: Contains four modules, one for each NoSQL database type: Key-Value, Column Family, Document and Graph. Compared with traditional the RDBMS world, they are like the JDBC API.

Mapping Layer: This layer is annotation-driven and uses technologies like CDI and Bean Validation, making it simple for developers to use. In the traditional RDBMS world, this layer can be compared to the Java Persistence API or object-relational mapping frameworks such as Hibernate."

The two pieces in bold:

  1. It defines a set of APIs and provides a standard implementation for most NoSQL databases.
  2. The project has two layers that define communication with NOSQL databases through API’s. There are: (a) Communication Layer, (b) Mapping Layer

are the same, because

  • "a set of APIs" of "1)" is "Mapping Layer" of "2)" and
  • "standard implementation for most NoSQL databases" of "1)" is "Communication Layer" of "2)".

So the final version of the introduction, in my opinion, should be:

"Jakarta NoSQL is a Java framework that streamlines the integration of Java applications with NoSQL databases.

The project has two layers that define communication with NoSQL databases through API’s. There are:

Mapping Layer: This layer is annotation-driven and uses technologies like CDI and Bean Validation, making it simple for developers to use. In the traditional RDBMS world, this layer can be compared to the Java Persistence API or object-relational mapping frameworks such as Hibernate.

Communication Layer: Contains four modules, one for each NoSQL database type: Key-Value, Column Family, Document and Graph. Compared with traditional the RDBMS world, they are like the JDBC API.

This clearly helps to achieve very low application coupling with the underlying NoSQL technologies used in applications."

And I think now it more clear and understandable.

Thank you,
Dmitri.

Add support to Jakarta Data

After the first beta version of Jakarta Data, let's implement it on the NoSQL specification side.

The scope of this issues includes:

  • Support for both Entity and Id annotation
  • Add support to Repository from Jakarta Data
  • Remove and document the current Jakarta NoSQL about the migration to Jakarta Data.

Caused by: java.lang.ClassNotFoundException: javax.annotation.Priority

Hi

I tried to use sample from the official documentation http://www.jnosql.org/docs/document.html. However I've got a pretty strange exception:

Caused by: java.lang.NoClassDefFoundError: javax/annotation/Priority
	at jakarta.nosql.ServiceLoaderSort.of(ServiceLoaderSort.java:67)

ServiceLoaderSort class from the communication-core module(version 1.0.0-b2) is defined in jakarta.nosql package but imports type from javax projects:

import javax.annotation.Priority;

Is it correct behavior?

Upgrade Jakarta EE API

Jakarta EE has updated to version 10.0, and Jakarta NoSQL is still on the version previous of the Jakarta big bang.

Once we have more Jakarta EE and MicroProfile vendors that support the version after the Jakarta Big bang, it is an excellent time to move forward with this upgrade.

Add support to prepare to skip and limit on the query

@Query("select * from Variants where caseLevelData.biosampleId =@biosampleId skip @skip limit @limit")
List<VariantEntity> findByBiosampleId(@Param("biosampleId") String
biosampleId, @Param("skip") int skip, @Param("limit") int limit);

Unfortunately, this doesn't work either. I got an ANTLR exception:

QueryException: line 1:75 mismatched input '@skip' expecting INT

We need to add support to parameter types on skip and limit.

A deep review of Jakarta NoSQL after the only mapping decision

After we decided to move Jakarta NoSQL only with the Mapping side and the regular part, we removed a considerable amount of code keeping:

The template interfaces
Mapping annotations

The goal would be to review and check the following points:

  • Check if the README file is updated.
  • Check if the spec has been updated.
  • Check if the JavaDoc is ready.

Also, you can say that all feedbacks are welcome.

Improve Query to both Document and Column communication API

Currently, we have query support using a fluent API to both select and delete, but it has several limitations, such as evolute complex conditions.

The proposal is to add a builder method in the Query interfaces such as DocumentQuery, ColumnQuery, etc. This way, it will create more complex queries easier without using the fluent API.

Sort sortName = Sort.asc("name");
Sort sortYear = Sort.desc("year");
DocumentCondition isPoliana = DocumentCondition.eq(Document.of("name", "Poliana"));
DocumentCondition isMillennium = DocumentCondition.gte(Document.of("year", 2000));
DocumentCondition condition = DocumentCondition.and(isPoliana, isMillennium);
     
DocumentQuery query = DocumentQuery.builder("column", "column2")
                             .where(condition)
                             .sort(sortName)
                             .sort(sortYear)
                             .limit(3)
                             .skip(2)
                             .build();

Furthermore, it will make it easier to implement the Criteria API.

Repository injection doesn't work

I am using Wildfly 21.0.0 (so I have CDI/Weld as required)

Any combination of

@Produces
@Database(DatabaseType.KEY_VALUE)
protected BucketManager produce() {
    return manager;
}

or

@Produces
protected BucketManager produce() {
    return manager;
}

Isn't enough to inject

@Inject
@Database(DatabaseType.KEY_VALUE)
private StringValueRepository repository;

or

@Inject
private StringValueRepository repository;

org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type StringValueRepository with qualifiers @database

or

org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type StringValueRepository with qualifiers @default

Of course if the Produces method returns a StringValueRepository directly, then it works.

Since this kind of "indirect" injection is mentioned in different parts of jnosql spec/documentation I wonder what I am doing wrong :

http://www.jnosql.org/spec/
http://www.jnosql.org/docs/key-value.html

Little help please ?

Thank you in advance

Improving of the first Chapters' introduction content - 2.

Hi Team,

another observation for improving content of the Introduction to "Chapter 1"...

I think that the piece:
"Vendor lock-in is one of the things any Java project needs to consider when choosing NoSQL databases. If there’s a need for a switch, other considerations include: time spent on the change, the learning curve of a new API to use with this database, the code that will be lost, the persistence layer that needs to be replaced, etc. Jakarta NoSQL avoids most of these issues through the Communication APIs. It also has template classes that apply the design pattern 'template method’ to databases operations. And the Repository interface allows Java developers to create and extend interfaces, with implementation automatically provided by a Jakarta NoSQL implementation: support method queries built by developers will automatically be implemented for them."

should become:
"_Vendor lock-in is one of the things any Java project needs to consider when choosing NoSQL databases. If there’s a need for a switch, other considerations include: time spent on the change, the learning curve of a new API to use with this database, the code that will be lost, the persistence layer that needs to be replaced, etc. Jakarta NoSQL avoids most of these issues through the APIs of Communication and Mapping Layers.

Jakarta NoSQL also has template classes that apply the design pattern 'template method’ to databases operations. And the Repository interface allows Java developers to create and extend interfaces, with implementation automatically provided by a Jakarta NoSQL implementation: support method queries built by developers will automatically be implemented for them._"

Let me know if my proposal make the content more structural and more understandable to readers.

Thank you,
Dmitri.

Fix README

The README document still mentions JNoSQL everywhere, it should change to NoSQL in relevant places. Also in the CONTRIBUTING file.

Define a standard for readme at the Jakarta NoSQL/JNoSQL projects.

A good readme helps new contributors and users. It includes the documentation itself.

The proposal here is to define sessions that make sense in all projects.

We can explore several projects and articles with this goal.

At this point, it might be worthwhile to discuss with it makes sense to return to markdown instead of asciidoc to have features such as Table Of Content.

References:

Define the package name domain to key-value.

As you know Jakarta NoSQL has one API to cover these NoSQL databases:

  • Column
  • Document
  • Graph
  • key-value

The domain to the first one is elementary, once we are talking about a sample name:

  • jakarta.nosql.column
  • jakarta.nosql.document
  • jakarta.nosql.graph

The key-value is a bit difficult one even if we take a look at the convention:
https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

I have some suggestions:

  • jakarta.nosql.value
  • jakarta.nosql.kv (my favorite one and what Oracle NoSQL is using)
  • any other options?

What do you think?

Upgrading the API for exploring Java 17 style

Following the Jakarta Data issue about the topic:
jakartaee/data#70

The goal is to remove all get as the prefix on the methods, such as getResult, getSingleResult, and convert those to result and singleResult.

This issue will break compatibility with the previous version.

TCK Proposal for Jakarta NoSQL

Context

TCK is an acronym for Technology Compatibility Kit, which comprises a series of tests that ensure a particular technology implementation is consistent with the corresponding specification. We aim to develop a TCK proposal design for Jakarta NoSQL, a Jakarta EE specification.

Challenges

  • Create a straightforward TCK to test with the Jakarta EE environment.
  • It is considering that the focus is on integrating Java/Spec and Data. That has considerable complexity, such as BASE vs. ACID, besides different types of NoSQL and particular behaviors.

Proposal:

  • What I have on my mind is to create a super simple TCK that needs feel requirements such as Jupiter and AssertJ.
  • Split the DI complexity out, using SPI instead of exploring inversion of Control as a supplier. Focus on Data-Driven design; once we're talking about mostly database integration with Jakarta EE.
  • Once we have four APIs (core, Key-value, column, document), it is easier for the user to do the same, thus including the TCK that it needs.
  • We'll explore the test guide that already does exist.
public void shouldInsert(Book book, Template template) {

assertThat(template.find(Book.class, book.id())).isEmpty();
template.insert(book);
assertThat(template.find(Book.class, book.id())).isPresent();
//more code here
}
}

Refactoring Spec at Jakarta NoSQL

At the spec, we have several concepts around NoSQL and their definition. To reduce and make the spec more cohesive, we can reduce it by removing what does not belong to API and putting links instead.

Define Parent

Define a Parent like all other Jakarta EE Specs:

    <parent>
        <groupId>org.eclipse.ee4j</groupId>
        <artifactId>project</artifactId>
        <version>1.0.5</version>
    </parent>

Handle DbRef in Mongo

Mongo drivers itself can handle the dbref case.

{
  'title': 'test title', 
  'comments': [ uuid-1, 2, 3] //ref to comment document
}

we can add and remove comment from Post.comments node directly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.