title: Getting org.postgresql.util.PSQLException: ERROR: syntax error at or near "." in JPA
body: <p>I am getting this below error.</p>
  
  <pre><code>2018-08-01 20:32:29.330[0;39m [33m WARN[0;39m [35m11960[0;39m [2m---[0;39m [2m[nio-9092-exec-5][0;39m [36mo.h.engine.jdbc.spi.SqlExceptionHelper  [0;39m [2m:[0;39m SQL Error: 0, SQLState: 42601
  [2m2018-08-01 20:32:29.330[0;39m [31mERROR[0;39m [35m11960[0;39m [2m---[0;39m [2m[nio-9092-exec-5][0;39m [36mo.h.engine.jdbc.spi.SqlExceptionHelper  [0;39m [2m:[0;39m ERROR: syntax error at or near "."
    Position: 16
  [2m2018-08-01 20:32:29.347[0;39m [31mERROR[0;39m [35m11960[0;39m [2m---[0;39m [2m[nio-9092-exec-5][0;39m [36mo.a.c.c.C.[.[.[/].[dispatcherServlet]   [0;39m [2m:[0;39m Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
  
  org.postgresql.util.PSQLException: ERROR: syntax error at or near "."
    Position: 16
  </code></pre>
  
  <p>I want to return a custom object of count as below in repository interface.</p>
  
  <pre><code>@Query(value="SELECT " +
          "   new com.telenor.wipro.logging.jpa.entity.setTPSEntities(COUNT(distinct gu_id), service_name) "
          + "FROM fuse_logs WHERE GROUP BY service_name",nativeQuery=true)
  public List&lt;FuseTPS&gt; findByTPS();
  </code></pre>
  
  <p>Please help.</p>