title: "ORA-00979: Not a Group By expression" with Hibernate HQL
body: <p>I am executing the following <strong>HQL query</strong> in an Oracle database:</p>
  
  <pre><code>select p, count(e) 
  from Entity p 
  join p.elementsA l 
  join l.elementsB e 
  group by p 
  order by p.name
  </code></pre>
  
  <p>This works nicely in a MySQL database but when I change the Dialect to Oracle10g it seems it's not using all fields in p to create the group by clause (as required by Oracle) thus producing an "ORA-00979: Not a Group By expression". I understand that by changing the Dialect Hibernate should transform this HQL into a valid SQL sentence for ORacle.</p>
  
  <p>Am I wrong? I am using Oracle10g dialect.</p>
  
  <p>EDIT: Now I've found it does not translate other queries to Oracle dialect. Like this one:</p>
  
  <pre><code>select
          e 
      from
          Entity e 
      where
          e.idEntity in (
              :idList
          ) 
      order by
          field(e.idEntity ,
          :idList)
  </code></pre>
  
  <p>Now I understand Oracle does not support order by field sentences but shouldn't HQL be translating it properly to Oracle syntax (i.e. <code>order by decode(e.idEntity, ...)</code>)?</p>