mybatis jpa repository 方法关键词对应关系表

博客介绍了JPA的SQL特点,其是面向对象的,from后的表名可用相应实体类,占位符用?1代表参数里的第几个参数,类似MyBatis参数中的@Param。

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

注意:jpa的sql是面向对象的,因此from后的表名可以使用相应的实体类,占位符用?1代表参数里的第几个参数,相当于mybatis参数中的@param。

KeywordSampleJPQL snippet
IsNotNullfindByAgeNotNull… where x.age not null
LikefindByNameLike… where x.name like ?1
NotLikefindByNameNotLike… where x.name not like ?1
StartingWithfindByNameStartingWith… where x.name like ?1(parameter bound with appended %)
EndingWithfindByNameEndingWith… where x.name like ?1(parameter bound with prepended %)
ContainingfindByNameContaining… where x.name like ?1(parameter bound wrapped in %)
OrderByfindByAgeOrderByName… where x.age = ?1 order by x.name desc
NotfindByNameNot… where x.name <> ?1
InfindByAgeIn… where x.age in ?1
NotInfindByAgeNotIn… where x.age not in ?1
TruefindByActiveTrue… where x.avtive = true
FlasefindByActiveFalse… where x.active = false
AndfindByNameAndAge… where x.name = ?1 and x.age = ?2
OrfindByNameOrAge… where x.name = ?1 or x.age = ?2
BetweenfindBtAgeBetween… where x.age between ?1 and ?2
LessThanfindByAgeLessThan… where x.age < ?1
GreaterThanfindByAgeGreaterThan… where x.age > ?1
After/Before
IsNullfindByAgeIsNull… where x.age is null
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值