国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

Spring Data JPA 關鍵字Exists的用法說明

瀏覽:5日期:2023-07-11 16:11:14
Spring Data JPA 關鍵字Exists

查詢數據庫中的此數據是否已存在:

例子:

查詢sys_user表中的一個user是否存在,類SysUser對應的是數據庫中的sys_user表,SysUserId是表sys_user的主鍵類(ID類)。

如果查詢一個user,user的accountNo為demo。

userID為demo1,表sys_user的主鍵是accountNo和userID,下面代碼中的方法是查詢這個user是否存在,如果存在則返回true,不存在則返回false。

@Repositorypublic interface SysUserRepository extends JpaRepository<SysUser, SysUserId> { @Override boolean exists(SysUserId sysUserId);}Spring data jpa支持的關鍵字介紹 Sample JPQL snippet

And

findByLastnameAndFirstname

… where x.lastname = ?1 and x.firstname = ?2

Or

findByLastnameOrFirstname

… where x.lastname = ?1 or x.firstname = ?2

Is,Equals

findByFirstname,findByFirstnameIs,findByFirstnameEquals

… where x.firstname = ?1

Between

findByStartDateBetween

… where x.startDate between ?1 and ?2

LessThan

findByAgeLessThan

… where x.age < ?1

LessThanEqual

findByAgeLessThanEqual

… where x.age <= ?1

GreaterThan

findByAgeGreaterThan

… where x.age > ?1

GreaterThanEqual

findByAgeGreaterThanEqual

… 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

IgnoreCase

findByFirstnameIgnoreCase

… where UPPER(x.firstame) = UPPER(?1)

Keyword Sample JPQL snippet

And

findByLastnameAndFirstname

… where x.lastname = ?1 and x.firstname = ?2

Or

findByLastnameOrFirstname

… where x.lastname = ?1 or x.firstname = ?2

Is,Equals

findByFirstname,findByFirstnameIs,findByFirstnameEquals

… where x.firstname = ?1

Between

findByStartDateBetween

… where x.startDate between ?1 and ?2

LessThan

findByAgeLessThan

… where x.age < ?1

LessThanEqual

findByAgeLessThanEqual

… where x.age <= ?1

GreaterThan

findByAgeGreaterThan

… where x.age > ?1

GreaterThanEqual

findByAgeGreaterThanEqual

… 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

IgnoreCase

findByFirstnameIgnoreCase

… where UPPER(x.firstame) = UPPER(?1)

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: Spring
相關文章:
主站蜘蛛池模板: 免费看一级欧美毛片 | 99久久国产免费中文无字幕 | 欧美高清日本三级人妇 | 国产精品毛片在线更新 | 久久久久毛片免费观看 | 91成人软件 | 国产一区二区三区欧美精品 | 国内精品伊人久久久影视 | 亚洲国产精品一区二区第四页 | 免费一级欧美片片线观看 | 久久一级视频 | a级片在线观看免费 | 99精品国产高清一区二区三区香蕉 | 手机看片久久国产免费不卡 | 在线成人精品国产区免费 | 美女在线看永久免费网址 | 国产精品欧美韩国日本久久 | 欧美白人猛性xxxxx交69 | 欧美亚洲日本韩国一级毛片 | 日本三级午夜 | 久久综合九色综合欧洲色 | 国产黄色一级毛片 | 久久毛片视频 | 免费一级a毛片在线播放 | 在线亚州 | 日本免费人成黄页网观看视频 | 欧美一级毛片欧美一级 | 韩国美女爽快一毛片免费 | 日本成人午夜 | 国产成人精品久久综合 | chinese性老妇中国 | 久久精品一品道久久精品9 久久精品一区 | 免费观看一级特黄三大片视频 | 亚洲国产成人久久一区二区三区 | 国产va免费精品高清在线观看 | 精品一区二区久久久久久久网站 | 香蕉成人在线视频 | 一区国严二区亚洲三区 | 国产视频网站在线观看 | 久久成人毛片 | 中文 日本 免费 高清 |