0
Я бегу ниже запрос с использованием JPA и получения указанной ниже исключение:Получение MissingTokenException при запуске запроса через JPA
JPA Код:
int count = em.createQuery(QueryCollections.getSoldProductUpdateQuery(billGuid).toString()).executeUpdate();
Вот запрос:
Query:
UPDATE at_product currentproduct
JOIN
(SELECT
atbillfields.billeditemguid AS productguid,
COUNT(*) AS number_of_people_bought,
SUM(atbillfields.billeditemqty) AS soldquantity
FROM
jtbillingtest.at_salesbill atsalesbill
JOIN jtbillingtest.at_billfields atbillfields ON atsalesbill.billbatchguid = atbillfields.billbatchguid
WHERE
atsalesbill.billguid = '41'
GROUP BY atbillfields.billeditemguid) soldproductdetails ON soldproductdetails.productguid = currentproduct.productguid
SET
currentproduct.productQuantity = currentproduct.productQuantity - soldproductdetails.soldquantity
Исключение бросили jpa.
> Exception , line 1, column 34: syntax error at [JOIN]. Internal
> Exception: MissingTokenException(inserted [@-1,0:0='<missing
> SET>',<62>,1:34] at JOIN) at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1477)
> at myjavfxapp.dal.ProductDal.updateSoldProducts(ProductDal.java:46)
> at
> myjavfxapp.controller.BillingController$6.handle(BillingController.java:421)
> at
Но если я запустил этот запрос непосредственно на сервере MySQL, он работает безотказно. Пожалуйста, укажите, не пропустил ли я что-нибудь.
спасибо .. Это сработало – Firu