title: Hibernate only error: "Column must appear in the GROUP BY clause or be used in an aggregate function"
body: <p>I have this query generated by hibernate (printed on console) and it works fine if directly executed throwg pgAdmin4:</p>
  
  <pre><code>select
          my_entity0_.status as col_0_0_,
          calc_sub_status(
              my_entity0_.status,
              my_entity0_.sub_status
          ) as col_1_0_,
          count(my_entity0_.id) as col_2_0_ 
      from
          demand my_entity0_
      group by
          my_entity0_.status ,
          calc_sub_status(
              my_entity0_.status,
              my_entity0_.sub_status
          )
  </code></pre>
  
  <p>But in my application (using Spring Boot and Hibernate) I got this exception:</p>
  
  <pre><code>SQL Error: 0, SQLState: 42803
  ERROR: column "my_entity0_.sub_status" must appear in the GROUP BY clause or be used in an aggregate function
  </code></pre>
  
  <p>What can be done if the same query is working in pgAdmin, but not via jdbc?</p>
  
  <p>PS: <code>calc_sub_status</code> is a custom function, receives 2 strings and returns a string.</p>
  
  <p>PS2: criteria code:</p>
  
  <pre><code>cq.multiselect(status, calcSubStatus, cb.count(root))
                  .groupBy(status, calcSubStatus);
  </code></pre>