JPQL Invalid query key

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)

Exception Description: Invalid query key [
Query Key comprobante
   Base] 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 ( =")
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
  e.comprobante is not null
select e.articulo
from caerp$ComprobanteItemArticulo e
  e.comprobante is not null

Hi Marc,
Could you provide a data model for the JPQL query?
Perhaps e.comprobante is OneToMany/ManyToMany mapping. A path expression works only with ManyToOne/OneToOne mapping.
Try to rewrite query with:

select e.articulo from caerp$ComprobanteItemArticulo e join e.comprobante c where c.empresa = :session_empresa and (c <> :param_comprobante)

thats works great, thanks!!