org.hibernate.QueryParameterException: could not locate named parameter [templateId]
<p>Please find the code which I have used. Below HQL query fails saying that: </p>

<blockquote>
  <p>could not locate named parameter [templateId]</p>
</blockquote>

<p>But templateId exist in my model class. </p>

<p>Please help to resolve the issue or possible reason to get this type of error:</p>

<pre><code>session = sessionFactory.openSession();         
                Transaction tx = session.beginTransaction();
                String hql ="from FieldTemplate where templateId= :id";
                Query query = session.createQuery(hql);
                query.setParameter("templateId", id);
                List file=query.list();
                tx.commit();
                return (FieldTemplate) file.get(0);
</code></pre>

<p>Model file </p>

<pre><code>@Entity
@Table(name="EDW_FIELDS")
public class FieldTemplate {
    @Id
    @Column(name="ID")
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int Id;

    public int getId() {
        return Id;
    }

    public void setId(int id) {
        Id = id;
    }

    @Column(name="TEMPLATE_ID")
    private int templateId;

    public int getTemplateId() {
        return templateId;
    }

    public void setTemplateId(int templateId) {
        this.templateId = templateId;
    }

    @Column(name="FIELD_NAME")
    private String fieldName;

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    @Column(name="DISPLAY_ORDER")
    private int displayOrder;

    public int getDisplayOrder() {
        return displayOrder;
    }

    public void setDisplayOrder(int displayOrder) {
        this.displayOrder = displayOrder;
    }
}
</code></pre>

<p>Please help to resolve my problem</p>