title: CRUDRepository findBy foreign key id causing exception: Unable to locate Attribute with the the given name [classroomId] on this ManagedType
body: <p>I am getting an exception when creating a custom findBy method by a foreign key.</p>
  <p>Entity class:</p>
  <pre><code>@Entity
  @Getter
  @Setter
  public class Thread {
  
    private @Id @GeneratedValue Long id;
    private String subject;
  
    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnore
    private Classroom classroom;
  
    protected Thread() {}
  
    public Long getClassroomId() {
      return this.classroom.getId();
    }
  }
  </code></pre>
  <p>ThreadRepository class:</p>
  <pre><code>public interface ThreadRepository extends CrudRepository&lt;Thread, Long&gt; {
    List&lt;Thread&gt; findByClassroomId(Long id);
  }
  </code></pre>
  <p>I get the exception:</p>
  <pre><code>java.lang.IllegalArgumentException: Unable to locate Attribute  with the the given name [classroomId] on this ManagedType [com.futurerprood.unicycleservice.entity.threads.Thread]
  </code></pre>
  <p>But the exception goes away if I remove the <code>getClassroomId()</code> in the <code>Thread</code> class. I have this function so that the json serialization will pick up only the classroom id instead of the whole classroom object in an endpoint response.</p>
  <p>Why is this function causing the foreign key unable to be found?</p>