0% found this document useful (0 votes)
8 views5 pages

Repository Query Keywords

Uploaded by

chandhu7013
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views5 pages

Repository Query Keywords

Uploaded by

chandhu7013
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1/28/25, 6:39 PM Repository query keywords :: Spring Data JPA

Spring Data JPA / JPA / Repository query keywords

Repository query keywords


Repository query keywords

Supported query method subject keywords


Reserved methods
Supported query method predicate keywords and modifiers

Supported query method subject keywords


The following table lists the subject keywords generally supported by the Spring
Data repository query derivation mechanism to express the predicate. Consult the
store-specific documentation for the exact list of supported keywords, because
some keywords listed here might not be supported in a particular store.

Table 1. Query subject keywords

Keyword Description

find…By , read…By , General query method returning typically the repository type, a
get…By , query…By , Collection or Streamable subtype or a result wrapper such as
search…By , stream… Page , GeoResults or any other store-specific result wrapper. Can
By 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.

https://docs.spring.io/spring-data/jpa/reference/repositories/query-keywords-reference.html 1/5
1/28/25, 6:39 PM Repository query keywords :: Spring Data JPA

Keyword Description

delete…By , remove… Delete query method returning either no result ( void ) or the delete
By count.

…First<number>… , … Limit the query results to the first <number> of results. This key‐
Top<number>… word 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 key‐
word can occur in any place of the subject between find (and the
other keywords) and by .

Reserved methods
The following table lists reserved methods that use predefined functionality (as
defined in CrudRepository ). These methods are directly invoked on the back‐
ing (store-specific) implementation of the repository proxy. See also “Defining
Query Methods”.

Table 2. Reserved methods

deleteAllById(Iterable<ID> identifiers)

deleteById(ID identifier)

existsById(ID identifier)

findAllById(Iterable<ID> identifiers)

findById(ID identifier)

https://docs.spring.io/spring-data/jpa/reference/repositories/query-keywords-reference.html 2/5
1/28/25, 6:39 PM Repository query keywords :: Spring Data JPA

Supported query method predicate keywords and


modifiers
The following table lists the predicate keywords generally supported by the Spring
Data repository query derivation mechanism. However, consult the store-specific
documentation for the exact list of supported keywords, because some keywords
listed here might not be supported in a particular store.

Table 3. Query predicate keywords

Logical keyword Keyword expressions

AND And

OR Or

AFTER After , IsAfter

BEFORE Before , IsBefore

CONTAINING Containing , IsContaining , Contains

BETWEEN Between , IsBetween

ENDING_WITH EndingWith , IsEndingWith , EndsWith

EXISTS Exists

FALSE False , IsFalse

GREATER_THAN GreaterThan , IsGreaterThan

GREATER_THAN_EQUALS GreaterThanEqual , IsGreaterThanEqual

IN In , IsIn

IS Is , Equals , (or no keyword)

https://docs.spring.io/spring-data/jpa/reference/repositories/query-keywords-reference.html 3/5
1/28/25, 6:39 PM Repository query keywords :: Spring Data JPA

Logical keyword Keyword expressions

IS_EMPTY IsEmpty , Empty

IS_NOT_EMPTY IsNotEmpty , NotEmpty

IS_NOT_NULL NotNull , IsNotNull

IS_NULL Null , IsNull

LESS_THAN LessThan , IsLessThan

LESS_THAN_EQUAL LessThanEqual , IsLessThanEqual

LIKE Like , IsLike

NEAR Near , IsNear

NOT Not , IsNot

NOT_IN NotIn , IsNotIn

NOT_LIKE NotLike , IsNotLike

REGEX Regex , MatchesRegex , Matches

STARTING_WITH StartingWith , IsStartingWith , StartsWith

TRUE True , IsTrue

WITHIN Within , IsWithin

In addition to filter predicates, the following list of modifiers is supported:

Table 4. Query predicate modifier keywords

Keyword Description

https://docs.spring.io/spring-data/jpa/reference/repositories/query-keywords-reference.html 4/5
1/28/25, 6:39 PM Repository query keywords :: Spring Data JPA

Keyword Description

IgnoreCase , Used with a predicate keyword for case-insensitive comparison.


IgnoringCase

AllIgnoreCase , Ignore case for all suitable properties. Used somewhere in the query
AllIgnoringCase method predicate.

OrderBy… Specify a static sorting order followed by the property path and direc‐
tion (e. g. OrderByFirstnameAscLastnameDesc ).

Copyright © 2005 - 2025 Broadcom. All Rights Reserved. The term


"Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
Terms of Use • Privacy • Trademark Guidelines • Thank you • Your
California Privacy Rights • Cookie Settings
Apache®, Apache Tomcat®, Apache Kafka®, Apache Cassandra™, and
Apache Geode™ are trademarks or registered trademarks of the Apache
Software Foundation in the United States and/or other countries. Java™,
Java™ SE, Java™ EE, and OpenJDK™ are trademarks of Oracle and/or its
affiliates. Kubernetes® is a registered trademark of the Linux Foundation
in the United States and other countries. Linux® is the registered
trademark of Linus Torvalds in the United States and other countries.
Windows® and Microsoft® Azure are registered trademarks of Microsoft
Corporation. “AWS” and “Amazon Web Services” are trademarks or
registered trademarks of Amazon.com Inc. or its affiliates. All other
trademarks and copyrights are property of their respective owners and
are only mentioned for informative purposes. Other names may be
trademarks of their respective owners.

https://docs.spring.io/spring-data/jpa/reference/repositories/query-keywords-reference.html 5/5

You might also like