我有用JPQL和eclipse链接和derby数据库编写的查询

"select  sum(LedgerDetailTable.debitValue) - sum(LedgerDetailTable.creditValue) from      LedgerDetailTable as LedgerDetailTable  left join LedgerMasterTable as LedgerMasterTable on LedgerDetailTable.ledgerMasterId = LedgerMasterTable.id  left join ReferenceTable as ReferenceTable on LedgerMasterTable.referenceId = ReferenceTable.id where      LedgerDetailTable.assistantAccountId = 1 AND ReferenceTable.workDateTime <" + "'" + workDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'"

我有错误
Caused by: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "T19" at line 1, column 275.

从eclipse链接日志生成的sql
SELECT (SUM(t0.debitValue) - SUM(t0.creditValue)) FROM LedgerDetailTable t0 LEFT OUTER JOIN LedgerMasterTable t1 ON (t0.ledgerMasterId = t1.id) LEFT OUTER JOIN ReferenceTable t2 ON (t1.referenceId = t2.id) WHERE ((t0.assistantAccountId = 1) AND (t2.workDateTime < 2020-02-27T19:41:52))

为什么Java在没有单引号的情况下将'2020-02-27 19:41:52'转换为2020-02-27T19:41:52

最佳答案

eclipselink 2.7升级到2.7.6解决的问题

10-08 17:38