Keyword | Sample | JPQL snipet |
---|---|---|
AND | findByLastnameAndfirstname | … WHERE x.lastname =?1 AND x.firstname =?2 |
Or | findByLastnameOrFirstname | … WHERE x.lastname =?1 OR x.firstname =?2 |
Between | findByStartDateBetween | … WHERE x.startDate between 1? AND 2? |
LessThan | findByAgeLessThan | … WHERE x.age < ?1 |
GreaterThan | findByAgegREATEThan | … WHERE x.age > ?1 |
After | findByStartdateAfter | … WHERE x.startDate > ?1 |
Before | findByStartDateBefore | … WHERE x.startDate <?1 |
IsNull | findByAgeIsNull | … WHERE x.age is null |
IsNotNull,NotNull | findByAge(Is)NotNull | … Where x.age not null |
Like | findByFirstnameLike | … WHERE x.firstname LIKE ?1 |
NotLike | findByFirstnameNotLike | … WHERE x.firstname NOT LIKE ?1 |
StartingWith | findByFirstnameStartingWith | … WHERE x.firstname LIKE ?1(parameter bound with appended %) 后置 |
EndingWith | findByFirstnameEndingWith | … WHERE x.firstname LIKE ? 1(parameter bound with prepended %) 前置 |
Containing | findByFirstnameContaining | … WHERE x.firstname LIKE ?1(parameter bound wrapped in %) |
OrderBy | findByAgeOrderByLastnameDesc | … WHERE x.age =?1 ORDER BY x.lastname DESC |
Not | findByLastnameNot | … WHERE x.lastname <>?1 |
In | findByAgeIn(Collection ages) | … WHERE x.age IN ?1 |
NotIn | findByAgetNotIn(Collectionage) | … WHERE x.age NOT IN ?1 |
TRUE | findByActiveTrue() | … WHERE x.active =TRUE |
FALSE | findByActiveFalse() | … WHERE x.active = FALSE加粗样式 |
JPA+SpringData Repository 接口规范方法支持的关键词
最新推荐文章于 2023-09-15 15:27:51 发布