赞
踩
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#appendix.query.method.subject
Keyword | Description |
---|---|
find…By , read…By , get…By , query…By , search…By , stream…By | General query method returning typically the repository type, a Collection or Streamable subtype or a result wrapper such as Page , GeoResults or any other store-specific result wrapper. Can be used as findBy… , findMyDomainTypeBy… or in combination with additional keywords. |
exists…By | Exists projection, returning typically a boolean result. |
count…By | Count projection returning a numeric result. |
delete…By , remove…By | Delete query method returning either no result (void ) or the delete count. |
…First<number>… , …Top<number>… | Limit the query results to the first <number> of results. This keyword can occur in any place of the subject between find (and the other keywords) and by . |
…Distinct… | Use a distinct query to return only unique results. Consult the store-specific documentation whether that feature is supported. This keyword can occur in any place of the subject between find (and the other keywords) and by . |
interface PersonRepository extends Repository<Person, Long> { List<Person> findByEmailAddressAndLastname(EmailAddress emailAddress, String lastname); // Enables the distinct flag for the query List<Person> findDistinctPeopleByLastnameOrFirstname(String lastname, String firstname); List<Person> findPeopleDistinctByLastnameOrFirstname(String lastname, String firstname); // Enabling ignoring case for an individual property List<Person> findByLastnameIgnoreCase(String lastname); // Enabling ignoring case for all suitable properties List<Person> findByLastnameAndFirstnameAllIgnoreCase(String lastname, String firstname); // Enabling static ORDER BY for a query List<Person> findByLastnameOrderByFirstnameAsc(String lastname); List<Person> findByLastnameOrderByFirstnameDesc(String lastname); }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。