Reputation: 77
In my Spring Repository (CRUD) I want to bypass the @Query annotation and query using Spring Data JPA Query Creation and Entity
by its Id and where a boolean : Deleted
of it is set to false
. I tried :
ReturnType findByIdAndDeletedFalse(@Param("id") Long id)
My question is : is it possible to write it that way to do the query ? I am using MongoDB,
Thanks for the guidance.
Upvotes: 2
Views: 3130
Reputation: 8203
https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#repository-query-keywords
IsFalse
is a repository query keyword and so you can use findByIdAndDeletedIsFalse
Upvotes: 2