3 Replies Latest reply on Nov 25, 2005 4:34 AM by Emmanuel Bernard

    Query works in MySql but not in HQL

    dornus Novice

      I am trying to run a basic query involving 2 tables, and it works in MySql but doesn't work using the createQuery() method.

       Query q1 = em.createQuery(
       "select count(o) "+
       "from TableOne o, TableTwo p " +
       "where o.columnA = :colA "+
       "and o.primaryKey = p.foreignKey "+
       "and p.id = :id"
       q1.setParameter("colA", "blah");
       q1.setParameter("id", 1);
       System.out.println("Count: "+(Integer) q1.getSingleResult());

      Am I missing something in the syntax?