243
文章
15
说说
181
评论
248026
访问

个人博客网站:prettywordpress.com(吃饭用大碗的程序猿)

最新评论
qq_avatar
1年前,”四五设计网”在《如何使用百度云CDN优化wordpress速度》
说:来学习一下,应该用得上
qq_avatar
2年前,” ”在《友情链接》
说:像不能用了更新地址为 https://aba.pet/wp-content/uploads/2022/05/favicon-1.gif
qq_avatar
2年前,”Alex”在《终于找到拖慢网站的罪魁祸首》
说:优化这么快,你有想过我们的感觉?
qq_avatar
3年前,”ヘル”在《码农=新生代农民工》
说:打卡@[huaixiao]
qq_avatar
3年前,”肋巴骨”在《Win10系统桌面一直闪屏自动刷新怎么办》
说:不错啊,这是谁写的教程,真棒
A+

JpaRepository常用关键词

标签: 最后编辑:2020年6月17日

1.JpaRepository支持接口规范方法名查询。意思是只要在接口中定义的查询方法符合规范,就不用写方法是如何实现的。

目前常用的关键词如下:

Keyword Sample JPQL snippet
NotNull findByAgeNotNull … where x.age not null
Like findByNameLike … where x.name like ?
NotLike findByNameNotLike … where x.name not like ?
OrderBy findByNameOrderByAge … where x.name= ? order by x.age desc
Not findByNameNot … where x.name <> ?
In findByAgeIn … where x.age in ?
NotIn findByAgeNotIn … where x.age not in ?
True findByActiveTrue … where x.avtive = true
Flase findByActiveFalse … where x.active = false
And findByNameAndAge … where x.name = ? and x.age = ?
Or findByNameOrAge … where x.name = ? or x.age = ?
Between findBtAgeBetween … where x.age between ? and ?
LessThan findByAgeLessThan … where x.age < ?
GreaterThan findByAgeGreaterThan … where x.age > ?
IsNull findByAgeIsNull … where x.age is null

2.JpaRepository相关查询功能

Spring Data JPA框架在进行方法名解析时,会先把方法名多余的前缀截取掉,比如find、findBy、read、readBy、get、getBy,然后对剩下部分进行解析.

————————————————
版权声明:本文为CSDN博主「Rm_and_Rf」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Rm_and_Rf/article/details/102951150

知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

发表一下你的评论呗

回复评论代表你同意网站的 隐私政策

... 友情提示 请保留版权标识
复制成功!
目录