title: JPA Unknown Column in Field List
body: <p>I have a relation between <code>Accommodation</code> and <code>Booking</code> classes, and also I set a foreign key in booking table.</p>
  
  <pre><code>ALTER TABLE `project`.`booking` 
  ADD INDEX `fk_accId_fk_idx` (`accommodation` ASC);
  ALTER TABLE `project`.`booking` 
  ADD CONSTRAINT `fk_accId_fk`
    FOREIGN KEY (`accommodation`)
    REFERENCES `project`.`accommodation` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION;
  </code></pre>
  
  <p>Accommodation class: </p>
  
  <pre><code>@Entity
    ....
  public class Accommodation implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    private BigInteger id;
  
    @OneToMany(mappedBy = "accommodation", fetch = FetchType.EAGER, cascade = CascadeType.REMOVE)
    @JsonManagedReference
    private List &lt; Booking &gt; bookings;
    ......getters setters
  }
  </code></pre>
  
  <p>Booking class:</p>
  
  <pre><code>@Entity
  public class Booking implements Serializable {
    ......
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "bookings", nullable = true)
    @JsonBackReference
    private Accommodation accommodation;
    ....getters setters
  }
  </code></pre>
  
  <p>When I execute a query for listing accommodations, I get unknown column in field list error.</p>
  
  <blockquote>
    <p>javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'bookings7_.bookings' in 'field list'</p>
  </blockquote>
  
  <p>Even I set the relation and define the foreign key in table, what is the reason that I get this error?</p>