title: JPA query couldn't find the right constructor
body: <p>So basically I try to get some data of a User by its ID and it has a field with @OneToOne relationship(bidirectional)</p>
  <p>When I try to create a query in JpaRepository
  with @Query annotation</p>
  <pre><code>@Query(&quot;SELECT new com.project.model.user(u.id, u.username, u.profile.last_online, u.profile.about) FROM User u WHERE id = :id)
  </code></pre>
  <p>and a constructor</p>
  <pre><code>User(long id, long username, Profile profile) {
     this.id = id;
     this.username = username;
     this.profile = profile;
  }
  </code></pre>
  <p>it still can't really find the constructor and says that there is no &quot;matching constructor&quot;, is there a way to create the constructor better?</p>