title: Spring Boot : perform a @query using a foreing key
body: <p>I am trying to get a bean using a foreing key as follow :</p>
  <p>-- the 1st bean containing the foreign Key (user_id : id) :</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>   @Entity
     @Table
     public class Class_1{
      @Id
      @SequenceGenerator(
         //code
              )
      @GeneratedValue(    
         //code
              )
      private Long id;
      
      @OneToOne
      @JoinColumn(name = "user_id", referencedColumnName = "id")
      private User user;
  
     /**
     * constructors , getters and setters, ... */
    }</code></pre>
  </div>
  </div>
  </p>
  <p>-- The 2nd bean i want to fill using the foreign Key :</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@Entity
  @Table
  public class User{
      
      @Id
      @SequenceGenerator(
              // code
              )
      @GeneratedValue(    
              //code
              )
      private Long id;
  
     /**
     * attributes, constructors , getters and setters, ... */
  }</code></pre>
  </div>
  </div>
  </p>
  <p>here are my Tables :</p>
  <pre class="lang-html prettyprint-override"><code>Table Class_1
  + ID + USER_ID +
  +----+---------+
  + 1  +   1     +
  
  Table User
  + ID + PARAM_1 + PARAM_2 + ... + PARAM_N +
  +----+---------+---------+-----+---------+
  + 1  +  value_1+ value_2 + ... + value_n +
  </code></pre>
  
  <p>Now this is the Query i try to execute :</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    @Query("SELECT * FROM CLass_1 c WHERE c.user_id.id=?1")
      public List&lt;Class_1&gt; findClass_1ByUser(Long userId);</code></pre>
  </div>
  </div>
  </p>
  <p>or (but still doesnt work :</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@Query("SELECT * FROM CLass_1 c WHERE c.user_id=?1")
      public List&lt;Class_1&gt; findClass_1ByUser(Long userId);
    
    @Query("SELECT * FROM CLass_1 c WHERE c.user=?1")
      public List&lt;Class_1&gt; findClass_1ByUser(User user);</code></pre>
  </div>
  </div>
  </p>
  <p>The exception :
  Validation failed for query for method public abstract java.util.List package.class_1.Class_1Repository.findClass_1ByUSer(java.lang.Long)!</p>
  <p>any help ?</p>
  <p>Thank you in advence :)</p>