title: org.hibernate.QueryException - could not resolve property
body: <p>I am trying to connect using Hibernate to a database. This current table has the following layout:</p>
  <pre><code>(field1, field2, field3, optional1, optional2...)
  </code></pre>
  <p>where field1, field2, field3 are all foreign keys, and together make up a composite key.</p>
  <p>I have the following classes:</p>
  <pre><code>@Entity
  @Table(name = &quot;db_table_mainRecords&quot;)
  public class MainRecord implements Serializable{
      @EmbeddedId
      private MainRecordKey   lqk;
      @Transient
      private String          field1;
      @Transient
      private int         field2;
      @Transient
      private int         field3;
      @Column(name = &quot;optional_1&quot;)
      private double          optional1;
      @Column(name = &quot;optional_2&quot;)
      private double          optional2;
  
  ....
    // Getters and setters for all fields, including fields within MainClassKey
  ....
  }
  </code></pre>
  <p>And this accompanying it:</p>
  <pre><code>@Embeddable
  @Table(name = &quot;db_table_mainRecords&quot;)
  public class MainRecordKey implements Serializable{
      @Column(name = &quot;field1&quot;)
      private String field_1; 
      @Column(name = &quot;field_2&quot;)
      private int field2;
      @Column(name = &quot;field_3&quot;)
      private int field3;
  }
  </code></pre>
  <p>I am getting the following error:</p>
  <blockquote>
  <p>org.hibernate.QueryException - could not resolve property: field3 of: path.MainRecord at  org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:67)</p>
  </blockquote>
  <p>Here is my Bo /dao code:</p>
  <pre><code>public List&lt;MainRecord&gt; getMainRecords(int e){
      Criterion crit1 = Restrictions.eq(&quot;field3&quot;, e);
      ArrayList&lt;MainRecord&gt; list = (ArrayList&lt;MainRecord&gt;) dao.getMainRecords(crit1);
  }
  
  
  public List&lt;MainRecord&gt; getMainRecords(Criterion criteria){
      if(criteria == null)
          return new ArrayList&lt;MainReocrd&gt;();
      return (List&lt;MainRecord&gt;) getHibernateTemplate().findByCriteria(DetachedCriteria.forClass(MainRecord.class).add(criteria));
  }
  </code></pre>