title: Java Hibernate sqlGroupProjection mysql Syntax error
body: <p>i need to translate this <code>SQL expression</code>into <code>Hibernate</code> using <code>Criteria</code> </p>
  
  <pre><code>select id,field1,field2,count(*) from my_table 
  group by field1,field2 having count(*)&gt;1;
  </code></pre>
  
  <p>here is my code so far.</p>
  
  <pre><code>    final Session session = ......
      ProjectionList projectionList = (ProjectionList)emptyProjection();
      projectionList.add(Projections.property("id"),"id"); 
      projectionList.add(Projections.groupProperty("codeI"));
      projectionList.add(Projections.groupProperty("codeII"));
      projectionList.add(Projections.sqlGroupProjection("count(*)","having count(*)&gt;1",new String[]{},new Type[]{StandardBasicTypes.INTEGER}));     
      final Criteria criteria = session.createCriteria(MyClass.class).setProjection(projectionList).setResultTransformer(transformer(MyClass.class));
      return new ArrayList&lt;MyClass&gt;(criteria.list());    
  </code></pre>
  
  <p>my problem is </p>
  
  <p>the criteria is generating this SQL.</p>
  
  <pre><code>group by
      this_.FIELD1,
      this_.FIELD2,
  
  having
      count(*)&gt;1
  </code></pre>
  
  <p>as you can see the second group by is followed by a <code>COMMA</code> <code>this_.FIELD2,</code> and mySQL is throwing <code>SyntaxError</code></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>here is my hibernate.cfg</p>
  
  <pre><code>&lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; 
  &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
  </code></pre>
  
  <p>and we are using <code>mysql 5.5.29</code> and <code>HIBERNATE 4.2.3</code></p>
  
  <p>i hope somebody give a tip.</p>
  
  <p>best regards..</p>