Spring Data GigaSpaces Appendix
Query Keywords
Supported Keywords
The following table lists the keywords that are supported by the Spring Data GigaSpaces repository query derivation mechanism.
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 |
FALSE | False, IsFalse |
GREATER_THAN | GreaterThan, IsGreaterThan |
GREATER_THAN_EQUALS | GreaterThanEqual, IsGreaterThanEqual |
IN | In, IsIn |
IS | Is, Equals, (or no keyword) |
IS_NOT_NULL | NotNull, IsNotNull |
IS_NULL | Null, IsNull |
LESS_THAN | LessThan, IsLessThan |
LESS_THAN_EQUAL | LessThanEqual, IsLessThanEqual |
LIKE | Like, IsLike |
NOT | Not, IsNot |
NOT_IN | NotIn, IsNotIn |
NOT_LIKE | NotLike, IsNotLike |
REGEX | Regex, MatchesRegex, Matches |
STARTING_WITH | StartingWith, IsStartingWith, StartsWith |
TRUE | True, IsTrue |
Unsupported Keywords
The keywords listed below aren't supported in GigaSpaces repositories.
Logical keyword | Keyword expressions |
---|---|
EXISTS | Exists |
NEAR | Near, IsNear |
WITHIN | Within, IsWithin |
Supported Querydsl Methods
The following Predicate
methods are supported by Spring Data GigaSpaces to build Querydsl queries:
- Number comparison:
eq
,ne
,lt
,loe
,goe
,between
,notBetween
- String comparison:
like
,matches
,isEmpty
,isNotEmpty
,contains
,containsIgnoreCase
,endsWith
,endsWithIgnoreCase
,startsWith
,startsWithIgnoreCase
- Other comparison:
isNull
,isNotNull
,in
,notIn
- Complex queries:
and
,or
- Embedded fields
contains
, startsWith
, endWith
and their ...IgnoreCase
equivalents use the Regular Expression
matches.
Supported Change API Methods
The following Change API methods are available while using Querydsl syntax (QChangeSet
class):
- Field:
set
,unset
- Numeric:
increment
,decrement
- Collections and maps:
addToCollection
,addAllToCollection
,removeFromCollection
,putInMap
,removeFromMap
- Lease:
lease
- Custom change:
custom
Unsupported Operations
Although we try to support every Spring Data feature, sometimes native implementation is not possible using a Space as a data source. Instead of providing workarounds, which are often slow, we decided to mark the following features as unsupported.
-
Using
IgnoreCase
,Exists
,IsNear
andIsWithin
keywords:public interface PersonRepository extends GigaspacesRepository<Person, String> { // these methods throw an UnsupportedOperationException when called List<Person> findByNameIgnoreCase(String name); List<Person> findByNameExists(boolean exists); List<Person> findByAgeIsNear(Integer nearAge); List<Person> findByAgeIsWithin(Integer minAge, Integer maxAge); }
-
Setting
Sort
toignoreCase
:public interface PersonRepository extends GigaspacesRepository<Person, String> { // these methods throw an UnsupportedOperationException when called List<Person> findByNameIgnoreCase(String name); List<Person> findByNameExists(boolean exists); List<Person> findByAgeIsNear(Integer nearAge); List<Person> findByAgeIsWithin(Integer minAge, Integer maxAge); }
-
Setting any
NullHandling
inSort
other thanNATIVE
:// NullHandling other than NATIVE is not supported Sort sorting = new Sort(new Order(ASC, "id", NullHandling.NULLS_FIRST)); // will throw an UnsupportedOperationException personRepository.findByNameEquals("paul", new PageRequest(1, 2, sorting));
-
Using query derivation in
GigaspacesDocumentRepository
:@SpaceDocumentName("Person") public interface DocumentQueries extends GigaspacesDocumentRepository<SpaceDocument, String> { @Query("name = ?") List<SpaceDocument> findByName(String name); // this declaration without @Query annotation // or named query from external resource // will throw UnsupportedOperationException during configuration List<SpaceDocument> findByAge(Integer age); }