Annotates a parameter of a repository method to specify the name of an entity attribute against which to compare.
Example usage for a Person entity with attributes
id, firstName, and lastName:
@Repository
public interface People extends BasicRepository<Person, Long> {
List<Person> findNamed(@By("firstName") String first,
@By("lastName") String last);
}
...
found = people.findNamed(first, last);
The By annotation is unnecessary when the method parameter name
matches the entity attribute name and the application is compiled with the
-parameters compiler option that makes parameter names available
at run time.
-
Required Element Summary
Required Elements
-
Element Details
-
value
String valueThe name of the entity attribute against which to compare.- Returns:
- the entity attribute name.
-