[英]The delete method from JpaRepository deletes all rows from the DB table
[英]Is it possible delete entity from DB and then return this value in JpaRepository?
所以我希望在下一步將我的實體返回對象刪除到Controller之后:
@Transactional
Author deleteByAuthorId(long authorId);
但我得到一個例外:
java.lang.ClassCastException: java.lang.Integer cannot be cast to ua.com.epam.entity.Author
可能嗎?
不,這是不可能的,因為spring JPA使用的底層API是PreparedStatement#executeUpdate
,它返回它已刪除的行的編號。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.