Skip to content

Delete by Predicate [DATAJPA-954] #1305

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 Aug 22, 2016 · 7 comments
Closed

Delete by Predicate [DATAJPA-954] #1305

spring-projects-issues opened this issue Aug 22, 2016 · 7 comments
Assignees
Labels
type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Lovro Pandžić opened DATAJPA-954 and commented

Add support for delete by Predicate (Querydsl)


Issue Links:

  • DATACMNS-553 QueryDslPredicateExecutor delete
    ("depends on")

Referenced from: pull request #184

1 votes, 4 watchers

@spring-projects-issues
Copy link
Author

Nikita Mishchenko commented

Could you provide(specify) more info about this idea?

@spring-projects-issues
Copy link
Author

Lovro Pandžić commented

Currently it is not possible to specify delete in statically typed way with Spring Data JPA and this is a pretty common use case.

Example usage:

userRepository.deleteWhere(user.surname.eq("Smith"));

@spring-projects-issues
Copy link
Author

Nikita Mishchenko commented

Should work as expected

@spring-projects-issues
Copy link
Author

Jens Schauder commented

The PR references a org.springframework.data.querydsl.QueryDslPredicateModifyingExecutor which doesn't exist. I'm not sure if it ever was part of another PR but I couldn't find it.

A generic delete method of this kind, i.e. one that is part of an interface in SD Commons should

  • trigger events for the entities deleted which means: It should load the entities and then iterate over those to delete them
  • a batch version similar to JpaRepository.deleteInBatch() would be possible in an JPA specific interface. Such an implementation should then take care of entities in the cache which probably means: flushing, clearing the persistence context, then deleting.

As a work around one could always use the existing find methods and delete the result.

This is nothing we would currently invest time in, but if someone wants to create a new PR I'm willing to merge it

@spring-projects-issues
Copy link
Author

Lovro Pandžić commented

Can you please explain why there was no response to this issue and PR by maintainers for over 2 years?

@spring-projects-issues
Copy link
Author

Jens Schauder commented

Lovro Pandžić Because no one found time to do it.
What else do you think would be the reason?

@spring-projects-issues
Copy link
Author

Lovro Pandžić commented

I suspected as much but I wanted confirmation. I find it concerning that someone invested their private time into a PR and then it's just discarded like this 2 years after.

Feel free to close this issue as I have developed an alternative for my case quite some time ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants