CUBA JPQL vs JPA JPQL : UPDATE and DELETE requires an alias


Difference between CUBA & JPA regarding JPQL supported are explained in the documentation.

However this page concentrates on SELECT, no hints on UPDATE & DELETE, where there is a general difference with JPA : CUBA always requires an alias.

This works in JPA not in CUBA.

UPDATE app$DeliveryAddress SET customer = :target WHERE customer = :source

com.haulmont.cuba.core.sys.jpql.JpqlSyntaxException: Errors found for input jpql:[]
CommonErrorNode [<mismatched token: [@8,41:41='=',<74>,1:41], resync=customer>]

To make it work with CUBA one need to define an alias,

UPDATE app$DeliveryAddress e SET e.customer = :target WHERE e.customer = :source

Same for DELETE

 DELETE FROM app$DeliveryAddress WHERE customer = :source: 
 DELETE FROM app$DeliveryAddress e WHERE e.customer = :source:

Not necessarily a big deal, but worth one line or two in the doc IMHO, because for UPDATE/DELETE alias is supposed to be optional.

Will do: