Search code examples
javajpaeclipselinkjpqlderby

Error in derby database after move to java 8 time in eclipse link jpa


i have query written in JPQL and eclipse link and derby database

"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")) + "'"

i got error

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

the generated sql from eclipse link log

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))

why java converted '2020-02-27 19:41:52' to 2020-02-27T19:41:52 with out single quates


Solution

  • the problem fixed by upgrade eclipselink 2.7 to 2.7.6