title: Hibernate HQL for finding by parameter and criteria
body: <p>Im struggeling to understand Hibernate HQL, being only used to sql, i dont understand whats wrong with my HQL. Any help would be greatly appriciated:</p>
  
  <pre><code>@Entity
  public class KursKode {
  
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private long id;
  private String kursKode;
  private boolean used;
  
  @ManyToOne
  @JoinColumn (name = "kursId")
  @LazyCollection(LazyCollectionOption.FALSE)
  private Kurs kurs;
  ....
  }
  </code></pre>
  
  <p>Im trying to fetch only "KursKode"'s for a specific Kurs. And only "KursKodes" that have "used=false". So i tried this in my DAO:</p>
  
  <pre><code>List&lt;KursKode&gt; kursKodeList = getHibernateTemplate().find("from KursKode k where k.kurs.kursId = ? and not k.used", kursId);
  </code></pre>
  
  <p>But this gives me the following error:
  Data Access Failure</p>
  
  <p>unexpected AST node: . near line 1, column 74 [from no.dahlsdata.model.Kurs.KursKode k where k.kurs.kursId = ? and not k.used]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: . near line 1, column 74 [from no.dahlsdata.model.Kurs.KursKode k where k.kurs.kursId = ? and not k.used] </p>