CASE WHEN无法在Querydsl中使用WHERE子句

时间:2019-01-16 15:58:42

标签: hibernate jpa querydsl

这是我的谓词:

{"Custumer": [
{
  "CustumerId": "1",
  "Name": "Chris"
},
{
  "CustumerId": "2",
  "Name": "Ronja"
},
{
  "CustumerId": "3",
  "Name": "Thomas"
}],
"Order": [
{
  "OrderId": "1",
  "CustumerId": "1",
  "Article": "chocolate"
},
{
  "OrderId": "2",
  "CustumerId": "1",
  "Article": "apples"
},
{
  "OrderId": "3",
  "CustumerId": "2",
  "Article": "dogfood"
},
{
  "OrderId": "4",
  "CustumerId": "3",
  "Article": "keyboard"
},
{
  "OrderId": "4",
  "CustumerId": "3",
  "Article": "tomatos"
},
{
  "OrderId": "4",
  "CustumerId": "3",
  "Article": "green tea"
}]}

但是它不起作用。我收到以下异常:

new BooleanBuilder(
   new CaseBuilder().when(expression.hour().eq(time.getHour()))
   .then((Predicate) expression.minute().gt(time.getMinute()))
   .otherwise(expression.hour().gt(time.getHour()))
)

我认为休眠状态的WHERE子句中不允许使用“ CASE WHEN”吗? 谁能帮帮我吗?我想根据我的datetime字段中的时间进行过滤。我搜索了所有地方,但找不到任何有用的来源:(

我在JPA上使用Querydsl。

0 个答案:

没有答案