为什么Eclipselink会错误地更改联接的顺序



我在JPQL:中有一个这样的查询

SELECT ...
FROM Receipt AS receipt
JOIN Invoice AS invoice
ON receipt.invoiceID = invoice.id
LEFT JOIN Payment AS payment
ON receipt.paymentID = payment.id
LEFT JOIN CreditNote AS creditNote
ON receipt.crmID = creditNote.id
LEFT JOIN Profile AS profile
ON invoice.accountID = profile.accountID
WHERE ...

然而,当我用EclipseLink运行它时,我得到了这个无效的本地查询

SELECT ...
FROM   receipts t0
LEFT OUTER JOIN payments t2
ON ( t0.payment_id = t2.id )
LEFT OUTER JOIN credit_notes t3
ON ( t0.crm_id = t3.id )
LEFT OUTER JOIN profiles t4
ON ( t1.account_id = t4.account_id ),
invoices t1
WHERE ...

如何解决此问题?

在我的案例中,我能够将所有联接的JOIN更改为LEFT JOIN,然后我的排序得到了遵守。

我怀疑根本问题是EclipseLink中的一个错误。

最新更新