Q:

Collection contains with @Query

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.

A:

Just use the following query and you're done:
@Query("From User u where :role member u.roles")

