title: Hibernate using Criteria setMaxResults giving SQLGrammarException
body: <p>I have made criteria, but when I use setMaxResults, it will give me exception SQLGrammarException. But when I comment setMaxResults, it will work an return all entries after first result. I'm using MySQL database.</p>
  
  <p>Code:</p>
  
  <pre><code>return criteria
              .setFirstResult(start)
              .setMaxResults(end)
              .setFetchSize(end)
              .list();
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>org.hibernate.exception.SQLGrammarException: could not execute query
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.loader.Loader.doList(Loader.java:2536)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
      at org.hibernate.loader.Loader.list(Loader.java:2271)
      at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
  
  ....
  
  Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ...
  </code></pre>