Hi, im trying to execute a JPQL query from cuba framework and i encountered an error saying “Invalid query key”… I found that this eror come arround from the where clause and is related to the joined entities, here I paste the code:
select e.articulo from caerp$ComprobanteItemArticulo e where e.comprobante.empresa = :session_empresa and (e.comprobante <> :param_comprobante)
QueryException:
Exception Description: Invalid query key [
Query Key comprobante
Base com.company.caerp.entity.Articulo] in expression.
Query: ReadAllQuery(referenceClass=Articulo jpql="select tempEntityAlias from caerp$Articulo tempEntityAlias, caerp$ComprobanteItemArticulo e where (e.comprobante.empresa = :session_empresa and (e.comprobante <> :param_comprobante)) and (tempEntityAlias.id = e.articulo.id)")
FetchGroup(){rubro => {class java.lang.Object=FetchGroup(rubro){deleteTs, id, nombre, deletedBy}}, codigo, estado, imagenes => {class java.lang.Object=FetchGroup(imagenes){descripcion, principal, deleteTs, image => {class java.lang.Object=FetchGroup(image){deleteTs, extension, size, name, id, version, deletedBy, createDate}}, incluirDocComerciales, width, articulo => {class java.lang.Object=FetchGroup(articulo){deleteTs, importeVenta, documento, id, nombre, version, deletedBy}}, id, nombre, version, deletedBy, height}}, importeVenta, documento, umVentas => {class java.lang.Object=FetchGroup(umVentas){deleteTs, id, nombre, deletedBy}}, nombre, version, deletedBy, linea => {class java.lang.Object=FetchGroup(linea){deleteTs, id, nombre, deletedBy}}, deleteTs, moneda => {class java.lang.Object=FetchGroup(moneda){deleteTs, id, nombre, deletedBy}}, id, category => {class java.lang.Object=FetchGroup(category){deleteTs, localeNames, name, id, version, deletedBy}}, empresa => {class java.lang.Object=FetchGroup(empresa){deleteTs, id, nombre, version, deletedBy}}}
And these are simpler examples with same error:
select a
from caerp$ComprobanteItemArticulo e
join e.articulo a
where
e.comprobante is not null
select e.articulo
from caerp$ComprobanteItemArticulo e
where
e.comprobante is not null