JPQL 意外的 AST 节点:大约 "coalesce"
JPQL unexpected AST node: around "coalesce"
JPQL got an error : threw
org.springframework.dao.InvalidDataAccessApiUsageException
(org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST
node: ( near line 3, column 48 ) select invoiceBE from InvoiceBE
invoiceBE where invoiceBE.institutionId = ?1 and
coalesce(invoiceBE.paidActivity.date < ?2) and
invoiceBE.exportedActivity.date < ?3 order by
invoiceBE.vendorInvoiceNumber asc
"coalesce"有没有错误?
我运行 sql 好在mysql 数据库中。
select
* from
ACQ_INVOICE invoice
where
invoice.institution_id=91475
and coalesce(invoice.`user_paid_date` < '2020-01-20', invoice.`paid_date` < '2020-01-20T16:45:40.786Z')
谢谢。
合并表达式看起来完全错误。
我不认为引用 属性 的反向标记是允许的。这看起来更像是 MySQL SQL 语法。
我也不完全确定 COALESCE
是否可以与布尔表达式一起使用。
改为
合并(发票。user_paid_date
,发票。paid_date
)<'2020-01-20'
成功了。
JPQL got an error : threw org.springframework.dao.InvalidDataAccessApiUsageException (org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: ( near line 3, column 48 ) select invoiceBE from InvoiceBE invoiceBE where invoiceBE.institutionId = ?1 and coalesce(invoiceBE.paidActivity.date < ?2) and invoiceBE.exportedActivity.date < ?3 order by invoiceBE.vendorInvoiceNumber asc
"coalesce"有没有错误?
我运行 sql 好在mysql 数据库中。
select
* from
ACQ_INVOICE invoice
where
invoice.institution_id=91475
and coalesce(invoice.`user_paid_date` < '2020-01-20', invoice.`paid_date` < '2020-01-20T16:45:40.786Z')
谢谢。
合并表达式看起来完全错误。
我不认为引用 属性 的反向标记是允许的。这看起来更像是 MySQL SQL 语法。
我也不完全确定 COALESCE
是否可以与布尔表达式一起使用。
改为
合并(发票。user_paid_date
,发票。paid_date
)<'2020-01-20'
成功了。