Skip to content

Add deleteAllById(Iterable<ID> ids) to CrudRepository and ReactiveCrudRepository [DATACMNS-800] #1263

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

Closed
spring-projects-issues opened this issue Jan 9, 2016 · 4 comments
Assignees
Labels
in: core Issues in core support in: repository Repositories abstraction type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Manuel Jordan opened DATACMNS-800 and commented

Just checking the API for CrudRepository

If we have findAll(Iterable<ID> ids) why not create delete(Iterable<ID> ids)?

It for the case where in a web form we have a list of items with a checkbox for each row with the ID shown or hidden. Once selected a set of rows we can delete them.

Thanks


Affects: 1.11.1 (Gosling SR1), 1.11.2 (Gosling SR2)

Issue Links:

  • DATACASS-825 Implement CrudRepository.delete(Iterable<ID> ids)
    ("is depended on by")
  • DATACOUCH-650 Implement CrudRepository.delete(Iterable<ID> ids)
    ("is depended on by")
  • DATAES-976 Implement CrudRepository.delete(Iterable<ID> ids)
    ("is depended on by")
  • DATAGEODE-387 Implement CrudRepository.delete(Iterable<ID> ids)
    ("is depended on by")
  • DATAGRAPH-1428 Implement CrudRepository.delete(Iterable<ID> ids)
    ("is depended on by")
  • DATAJPA-1818 Implement CrudRepository.delete(Iterable<ID> ids)
    ("is depended on by")
  • DATAKV-330 Implement CrudRepository.delete(Iterable<ID> ids)
    ("is depended on by")
  • DATALDAP-181 Implement CrudRepository.delete(Iterable<ID> ids).
    ("is depended on by")
  • DATAMONGO-2652 Implement CrudRepository.delete(Iterable<ID> ids)
    ("is depended on by")
  • DATAREDIS-1247 Implement CrudRepository.delete(Iterable<ID> ids)
    ("is depended on by")
  • DATAJDBC-629 Implement CrudRepository.delete(Iterable<ID> ids)

Referenced from: pull request #476

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

I guess the main reason we haven't done it so far is that delete(Iterable<? extends T> entities) already exists and the Java compiler rules don't allow us to have a second method named delete(…) with an Iterable as parameter (big thanks to type erasure, not).

However, I think we could create a deleteAll(Iterable<ID> ids). An argument could be made that that's inconsistent with the other delete(…) method, but I think we can argue that the find…(…) method taking an Iterable of identifiers is also named findAll(…)

@spring-projects-issues
Copy link
Author

Manuel Jordan commented

Thanks by the explanation. I hope it be possible to be implemented.

Theme apart:

Just curious: if exists findOne and findAll
Why not have been created saveOne and saveAll? I can see exists just save with Entity and Iterable.
Same though for deleteOne and deleteAll with ID, Entity and Iterable. I can see exists deleteAll but to delete all the data for a table

Thanks

@spring-projects-issues
Copy link
Author

Jens Schauder commented

With DATACMNS-944 done, we could now add a deleteAllById without any name clashes.

The challenge is that all stores need to implement it. Maybe a good way forward would be to have

  1. an additional interface with the new method
  2. add the implementation to the various SimpleXXXRepositories of the different stores.
  3. for the next major release where we can make breaking changes, add the method to the CrudRepository

@spring-projects-issues
Copy link
Author

Manuel Jordan commented

Thanks Jens by your post and mostly by share the link

@spring-projects-issues spring-projects-issues added in: repository Repositories abstraction type: enhancement A general enhancement in: core Issues in core support labels Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support in: repository Repositories abstraction type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants