title: Spring Boot JPA returns List of List not List of Object
body: <p>I am new to spring boot jpa. I would like to get return type as List but I am getting just List</p>
  
  <p>My Entity Class</p>
  
  <pre><code>@Component
  @Entity
  @Table(name = "USERDB.USERS")
  public class User() {
    @Id
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MY_SEQ")
      @SequenceGenerator(sequenceName = "MY_SEQ_NAME", allocationSize = 1), name = "MY_SEQ")
    @Column(name = "userId")
    private long id;
    @Column(name = "firstName")
    private String fName;
    @Column(name = "midName")
    private String mName;
    @Column(name = "lastName")
    private String lName;
    @Column(name = "email")
    private String email;
    @Column(name = "createdDate")
    private Timestamp createdOn;
  
  public User() {
      this.createdOn = new Timestamp(System.currentTimeMillis()
  }
  
  //SETTERS &amp; GETTERS
  
  }
  </code></pre>
  
  <p>My Repository;</p>
  
  <pre><code>public interface UserRepository extends JpaRepository&lt;User, String&gt; {
  
    @Query("SELECT id fName, lastName, email FROM User u WHERE u.fName=(:fName)")
    public List&lt;User&gt; findByEmail(@Param("fName") String fName);
  
  }
  </code></pre>
  
  <p>All I wanted is to get a json response as a User Array with key value pair like below </p>
  
  <pre><code>    [
     [
       "id": 1001,
       "fName": John",
       "lName": "Doe",
       "email": "johnd@example.com"       
     ],
     [
       "id": 1002,
       "fName": "John",
       "lName": "Simmons",
       "email": "johns@example.com"       
     ],
  
  ]
  </code></pre>
  
  <p>but I am getting a list with just values as below. </p>
  
  <pre><code>[
     [
       1001,
       "John",
       "Doe",
       "johnd@example.com"       
     ],
     [
       1002,
       "John",
       "Simmons",
       "johns@example.com"       
     ],
  
  ]
  </code></pre>
  
  <p>I am not sure where I am doing wrong or is this how I am supposed to get ? This is a hypothetical example of my actual program. Please excuse me for any errors.</p>
  
  <p>Here is my controller class</p>
  
  <pre><code>@Restcontroller
  public class UserController {
  @Autowired
  UserRepository repo;
  @GetMapping("/user/{fname}")
    public List&lt;User&gt; getUserByName(
           @PathVariable("fname") String fname) {
  
    return repo.findByEmail(fname);
    }
  }
  </code></pre>