No entity variable name [Variable: null]

Hi,

Where I run a jpql query in a service I get the following error

Caused by: com.haulmont.cuba.core.global.RemoteException: Errors found for input JPQL:[select c from salesordermngmt_Counterparties] No entity variable name [Variable: null]

The entity salesordermngmt_Counterparties exist

see below for code snippet

    try(Transaction tx = persistence.getTransaction("gcsblotter")) {

        EntityManager em = persistence.getEntityManager("gcsblotter");

        Query q = em.createQuery("select c from salesordermngmt_Counterparties");
        q.getFirstResult();
        tx.commit();

    }

Please help ! - Thanks

You forgot to “alias” your entity

select c from salesordermngmt_Counterparties c

Thanks Giuseppe works great !