【发布时间】:2013-12-07 00:56:41
【问题描述】:
我正在尝试使用 select 编写插入查询。 但我收到了这个错误 原因:org.hibernate.hql.ast.QuerySyntaxException:意外令牌:第 11 行第 23 列附近的订单
Query query = hibSession.createQuery("""
INSERT INTO
ProcessOrder(
version,
numberOfPeriods,
billingPeriodStart,
billingPeriodEnd,
invoice,
billingRun,
org,
order)
SELECT
1L AS version,
1 AS numberOfPeriods,
ilt.billingStartDate AS billingPeriodStart,
ilt.billingEndDate AS billingPeriodEnd,
i AS invoice,
i.billingRun as billingRun,
i.org as org,
soi as order
from
Invoice as i
join i.ordersIncluded as soi
join i.invoiceLineItems as ilt
where
i.billingRun = 36 AND
i.status IN ('Outstanding','Paid') AND
ilt.position = 1 """)
请帮助解决这个问题
【问题讨论】:
标签: java mysql hibernate grails hql