I want to delete an entity(ies) by multiple entity properties?
I know how to do it using JPA query
(@Query
annotation).
Is It possible to do it using derived query
? How to name such method in JpaRepository
?
It is straight forward as naming select method:
Two properties:
long deleteByIdAndUser(
@Param("id") Long id,
@Param("user") User user);
Three properties:
long deleteByIdAndUserAndStatus(
@Param("id") Long id,
@Param("user") User user,
@Param("status") String status);
etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With