title: Simple @ManyToOne relation: could not resolve property (org.hibernate.QueryException)
body: <p>I have this simple relationship - as can be seen in the picture:</p>
  
  <p><img src="https://i.stack.imgur.com/zV2HE.png" alt="enter image description here"></p>
  
  <p>As I try to read read out a certain city with a certain <code>Country_id</code>:</p>
  
  <pre><code>Country austria = (Country) session.load(Country.class, 1L); 
  // Works as expected
  System.out.println(austria.toString());        
  
  Criteria crCities = session.createCriteria(City.class);
  crCities.add(Restrictions.eq("Country_id", austria.getId()));
  // Crashes ..
  List&lt;City&gt; cities = crCities.list();
  
  System.out.println("Show cities of Austria:");
  for (City next : cities) {
      System.out.println(" - " + next.getName());
  }  
  </code></pre>
  
  <p>I'm getting the following error:</p>
  
  <blockquote>
    <p><code>Exception in thread "main" org.hibernate.QueryException: could not resolve property: Country_id of: com.mahlzeit.datamodel.geographic.City</code></p>
  </blockquote>
  
  <p>This are the POJOs:</p>
  
  <p><strong>Country.java</strong></p>
  
  <pre><code>package com.mahlzeit.datamodel.geographic;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  @Entity
  @Table
  public class Country {
  
      @Id
      @GeneratedValue
      private Long id;
  
      private String country_code;
  
      public String getCountryCode() {
          return country_code;
      }
  
      public void setCountryCode(String countryCode) { 
          this.country_code = countryCode;
      }
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      @Override
      public String toString() {
          return "Country [id=" + id.toString() + ", country_code=" + country_code.toString()  +"]";
      }
  }
  </code></pre>
  
  <p><strong>City.java</strong></p>
  
  <pre><code>package com.mahlzeit.datamodel.geographic;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  import javax.persistence.JoinColumn;
  import javax.persistence.ManyToOne;
  import javax.persistence.Table;
  
  @Entity
  @Table
  public class City {
  
      @Id
      @GeneratedValue
      private Long id;
  
      @ManyToOne
      @JoinColumn(name = "Country_id")
      private Country country;
  
      private String name;
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public Country getCountry() {
          return country;
      }
  
      public void setCountry(Country country) {
          this.country = country;
      }
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
       @Override
      public String toString() {
          return "City [id=" + id.toString() + ", country="
                  + country.toString() + ", name=" + name + "]";
      }
  }
  </code></pre>
  
  <p>What do I have to do to make this work? Is <code>@JoinColumn(name = "Country_id")</code> even correct in <strong>City.java</strong>?</p>