title: Can not accessing data records using nativeQuery method in springboot and Data JPA
body: <p>I tried <code>nativeQuery</code> method for fetching some data without using JPQL in my repository file using <code>Spring Boot</code>, <code>Spring Data JPA</code> method, I am adding my sample code below:</p>
  
  <pre><code>public interface UsersRepository extends CrudRepository&lt;Users, Long&gt; {
    @Query(value = "select u.username from users u",nativeQuery=true)
    List&lt;Users&gt; findByUsername();
  },
  </code></pre>
  
  <p>And calling the method  by,</p>
  
  <pre><code>UsersRepository userRepo;
  return (List&lt;Users&gt;) userRepo.findByUsername();
  </code></pre>
  
  <p>Then the error I am getting:</p>
  
  <blockquote>
    <p>"There was an unexpected error (type=Internal Server Error,
    status=500). could not execute query; SQL [select u.username from
    users u]; nested exception is
    org.hibernate.exception.SQLGrammarException: could not execute query".</p>
  </blockquote>
  
  <p>Can anyone help to solve this issue?</p>