Is there a way to use a "contains" function in a @Query
tag? If no, what is the best way to implement this?
Example:
@Query("From User u where u.roles contains :role")
List<User> findByRole(@Param("role") Role role);
The User
class does have a Collection
containing their Roles
.
Edit: As suggested i tried it with like, the application starts, but when this method gets executed a "not matching expected type" exception occurs.