Add query derivation for delete queries [DATAJDBC-551]
See original GitHub issuerod2j opened DATAJDBC-551 and commented
Derived delete/removeByXxx queries work as expected for return type void but fail when return type is long/Long or List<entity type>, where it should return the number of records or the list of entities actually deleted:
instead I get
org.springframework.aop.AopInvocationException: Null return value from advice does not match primitive return type for: public abstract long
it also appears the generated SQL query is actually a SELECT instead of a DELETE whenever the derived delete query has a non void return type.
Affects: 2.0 GA (Neumann)
Issue Links:
- DATAJDBC-568 Derived delete query throws IncorrectResultSetColumnCountException (“is duplicated by”)
Referenced from: pull request https://github.com/spring-projects/spring-data-jdbc/pull/230
2 votes, 7 watchers
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
Derived delete query throws ...
JdbcTemplate.query(JdbcTemplate.java:669) ~[spring-jdbc-5.2.7.RELEASE.jar!/:5.2.7. ... DATAJDBC-551 Add query derivation for delete queries
Read more >Spring Data JPA - Derived Delete Methods - Baeldung
Spring Data JPA allows us to define derived methods that read, update or delete records from the database. This is very helpful as...
Read more >Spring Data: "delete by" is supported? - Stack Overflow
In modern versions of Spring Data JPA (>=1.7.x) query derivation for delete ... Derivation of delete queries using given method name is supported...
Read more >Derived Queries with Spring Data JPA – The Ultimate Guide
You can let Spring Data JPA derive the query from the name of a method in your repository. You can define your own...
Read more >Spring Data JPA - Reference Documentation
... query derivation for both count and delete queries is available. ... This prevents Spring Data to try to create an instance of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Mark Paluch commented
Thanks for reporting the issue. Derived delete queries are not yet supported
Rob Maskell commented
I tried a derived delete query with a void return type and this exception was thrown
The repository method signature was