HQL查詢條件

2021-06-22 21:59:43 字數 1419 閱讀 1656

hql運算子

qbc運算子

含義

=

restrictions.eq()

等於equal

<>

restrictions.ne()

不等於not equal

>

restrictions.gt()

大於greater than

>=

restrictions.ge()

大於等於greater than or equal

<

restrictions.lt()

小於less than

<=

restrictions.le()

小於等於less than or equal

is null

restrictions.isnull()

等於空值

is not null

restrictions.isnotnull()

非空值like

restrictions.like()

字串模式匹配

and

restrictions.and()

邏輯與and

restrictions.conjunction()

邏輯與or

restrictions.or()

邏輯或or

restrictions.disjunction()

邏輯或not

restrictions.not()

邏輯非in(列表)

restrictions.in()

等於列表中的某乙個值

not in(列表)

restrictions.not(restrictions.in())

不等於列表中任意乙個值

between x and y

restrictions.between()

閉區間xy中的任意值

not between x and y

restrictions.not(restrictions..between())

小於值x或者大於值y

HQL 簡單的幾種帶條件查詢方法

條件查詢 可以採用拼字串的方式傳遞引數 可以採用 來傳遞引數 索引從0開始 可以採用 引數名 來傳遞引數 如果傳遞多個引數,可以採用setparamterlist方法 在hql中可以使用資料庫的函式,如 date format 第一種 可以拼字串 list students session.crea...

HQL 簡單的幾種帶條件查詢方法

條件查詢 可以採用拼字串的方式傳遞引數 可以採用 來傳遞引數 索引從0開始 可以採用 引數名 來傳遞引數 如果傳遞多個引數,可以採用setparamterlist方法 在hql中可以使用資料庫的函式,如 date format 第一種 可以拼字串 list students session.crea...

HQL多表查詢

物件之間總是有各種各樣的關係,關聯關係是類之間最常見的關係。多表查詢是hql中的強大功能之一,包括內連線 左連線和右連線等。在資料庫中用到了3個表 student 學生表 course 課程表 和sc 選課表 在現實模型中,乙個學生可以選擇多門課程,乙個課程可以被多個學生選擇,student和cou...