2

我有两个实体,即。InvoiceItem 和 ChargeCategory,使用 JPA 语义定义,带有@Columngetter。InvoiceItem#getChargeCategory() 定义如下:

@ManyToOne(optional = false)
@JoinColumn(name = "item_charge_category")
public ChargeCategory getChargeCategory()
{
    return chargeCategory;
}

现在,当我尝试使用给定的 item_charge_category 检索所有 InvoiceItems 时,如下所示:

SELECT * FROM InvoiceItem i 
WHERE i.chargeCategory.itemChargeCategory = :itemChargeCategory

我收到一个错误

Unexpected token: CROSS in statement 

声明如下:

SELECT 
    <Columns from InvoiceItem>
FROM   dist_invoice_items Invoicei0_
       CROSS JOIN invoice_charge_types Chargec1_ 
WHERE  Invoicei0_.item_charge_category = 
       Chargec1_.item_charge_category 
       AND Chargec1_.item_charge_category = ?  

我在用

  • 休眠:3.5.5
  • HSQLDB:2.0

和persistence.xml是

<persistence-unit name="fssPersistenceUnit" transaction-type="RESOURCE_LOCAL">
</persistence-unit>

有没有人遇到过类似的问题?知道如何纠正这个问题吗?如果有任何进一步的信息有助于解决这个问题,请告诉我。

4

0 回答 0