Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert and update methods on built-in repository #283

Merged

Conversation

njr-11
Copy link
Contributor

@njr-11 njr-11 commented Oct 4, 2023

It was just decided on today's Jakarta Data call that we will include the insert and update methods on the built-in repository interface. This pull copies over the updates for it from the #270 commits.

@njr-11 njr-11 added the design Improvements or additions to design label Oct 4, 2023
@njr-11 njr-11 added this to the Jakarta Data 1.0 milestone Oct 4, 2023
@otaviojava otaviojava merged commit 221833e into jakartaee:main Oct 5, 2023
@otaviojava
Copy link
Contributor

It does not work in some NoSQL databases, it should work with both, I will think a solution that return to work to both.

@njr-11
Copy link
Contributor Author

njr-11 commented Oct 5, 2023

It does not work in some NoSQL databases, it should work with both, I will think a solution that return to work to both.

If you identify any additional cases where some types of NoSQL databases are not capable, we can address it in the same we have previously done, for example,

     * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
     *         that use an append model to write data.
     */
    void insert(T entity);

@otaviojava
Copy link
Contributor

It does not work in some NoSQL databases, it should work with both, I will think a solution that return to work to both.

If you identify any additional cases where some types of NoSQL databases are not capable, we can address it in the same we have previously done, for example,

     * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
     *         that use an append model to write data.
     */
    void insert(T entity);

Nope, sometimes it works as an alias to update or as a kind of append.

Also, It might be more valuable if it returns the entity; there are cases in which I work with an immutable class that returns the entity with a new value, such as an ID is critical.

Relational might not be hard once it returns the interface itself, but if I don't have the option to return the entity result there is no way for the user to find it by the id, for example.

@njr-11
Copy link
Contributor Author

njr-11 commented Oct 5, 2023

Also, It might be more valuable if it returns the entity; there are cases in which I work with an immutable class that returns the entity with a new value, such as an ID is critical.

Relational might not be hard once it returns the interface itself, but if I don't have the option to return the entity result there is no way for the user to find it by the id, for example.

Relational databases would have the same problem. In those scenarios where the id is being generated, you should be using save, not insert.

@otaviojava
Copy link
Contributor

I will move the discussion to here:

#284

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Improvements or additions to design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants