Oracle JPA/标准API-不相似
我想使用谓词notLike(表达式x,字符串模式)替换以下查询:Oracle JPA/标准API-不相似,oracle,jpa-2.0,predicate,Oracle,Jpa 2.0,Predicate,我想使用谓词notLike(表达式x,字符串模式)替换以下查询: select * from mytable where mytable.myParameter not in ('ABC%','XYZ'); 但当我使用以下谓词执行查询时: Predicate notLike = builder.notLike(fromMyTable.get(MyTable_.myParameter), "ABC%|BCD"); 它不起作用 但是如果我为这两个字符串创建两个谓词:“ABC%”和“XYZ”正在工
select * from mytable
where mytable.myParameter not in ('ABC%','XYZ');
但当我使用以下谓词执行查询时:
Predicate notLike = builder.notLike(fromMyTable.get(MyTable_.myParameter), "ABC%|BCD");
它不起作用
但是如果我为这两个字符串创建两个谓词:“ABC%”和“XYZ”正在工作
我的模式写错了吗?问题出在哪里?我试图用多种方式改变这种模式,但仍然不起作用
谢谢大家! 在SQLA not In(X,Y,Z)
谓词是以下条件的快捷方式:
A <> X AND A <> Y AND A <> Z
或
从mytable中选择*
其中mytable.myParameter“XYZ”
mytable.myParameter与“ABC%”不同;
select * from mytable
where mytable.myParameter not in ('XYZ')
and mytable.myParameter not LIKE 'ABC%';
select * from mytable
where mytable.myParameter <> 'XYZ'
and mytable.myParameter not LIKE 'ABC%';