jakartaee / data

Data-API
Apache License 2.0
78 stars 26 forks source link

Consider moving function from the Jakarta NoSQL Template to Jakarta Data #108

Open njr-11 opened 1 year ago

njr-11 commented 1 year ago

I noticed function being added to Jakarta NoSQL Template under https://github.com/eclipse-ee4j/nosql/pull/151 that seems like it could be common with relational databases. We should consider if this or something similar can be made common to both relational and NoSQL databases under Jakarta Data. This is likely something to look at/consider after we get the repository pattern further along, not to start on yet.

UPDATED WITH MORE DETAIL:

Here's the example from the Jakarta NoSQL issue that I noticed,

template.select(Book.class).where("category").eq("Java").getResult();

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

It reminds me of Spring's Querydsl extension,

books.findAll(book.category.isNotNull().and(
              book.category.startsWithIgnoreCase("Java")));

Both Spring and Micronaut also have a JPA CriteriaBuilder-based approach as well by having the repository interface extend a JpaSpecificationExecutor<EntityType> interface.

I can see why Jakarta NoSQL would be hesitant to depend on the JPA criteria builder from the Jakarta Persistence spec, but it would be nice if a common solution could be found rather than adding function to Jakarta NoSQL that looks like it ought to be common to relational databases/Jakarta Data.

graemerocher commented 1 year ago

What is "function"? This needs more definition of what is being proposed here

keilw commented 1 year ago

That "function" is similar to the Spring Data Template Framework

njr-11 commented 1 year ago

I'm reopening this because I think it was closed by mistake. It still needs investigation. If the intent was to target the investigation for a future spec release, that can be done by setting the Milestone to "Jakarta Data Future".

otaviojava commented 1 year ago

ops, Yeap. My mistake. Thank you @njr-11