spring-data-jpa 为什么Eclipselink错误地更改了连接的顺序?

x4shl7ld  于 2022-11-10  发布在  Spring
关注(0)|答案(1)|浏览(123)

我在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 profile t4
                ON ( t1.account_id = t4.account_id ),
   bills t1
WHERE ...

如何解决此问题?

m2xkgtsf

m2xkgtsf1#

在我的例子中,我能够将所有连接的JOIN更改为LEFT JOIN,然后我的排序得到了尊重。
我怀疑根本问题是EclipseLink中的一个bug。

相关问题