1 Reply Latest reply on Jun 18, 2009 1:32 PM by Y E

    Aggregate function problem

    Y E Newbie

      Hello,
      I need to select a specific row from my Oracle DB into my entity class and I use this code:






      MyEntity ent= (MyEntity)  entityManager.createQuery("from MyEntity where col1 \= (select max(col1) from MyEntity where ent_id\=:ent)\")
              .setParameter(\"ent\", \"xxx\")
              .getSingleResult();






      The problem is that I get the following exception when I try to execute this:




      java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.AggregateNode \-[AGGREGATE] AggregateNode: 'max' \-[IDENT] 



      Could anyoneone please tell me what is wrong with this and how could I fix it.
      Thanks.