keyword in Jpa

本文详细解析了JPQL查询中各种操作符的用法,包括逻辑运算符、比较运算符、区间运算符、数值运算符等,并通过具体示例展示了如何在实际应用中运用这些查询技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Keyword Sample JPQL snippet
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 findByAgeGreaterThan… 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<Age> ages)… where x.age in ?1
NotIn findByAgeNotIn(Collection<Age> age)… where x.age not in ?1
True findByActiveTrue()… where x.active = true
False findByActiveFalse()… where x.active = false
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值