I have the following entity.
Code:
@Entity
@Table(name = "template_queue")
public class TemplateQueue {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private long id;
@ManyToOne
@JoinColumn(nullable = true)
private Queue queue;
@ManyToOne
private Template template;
public long getId() {
return id;
}
public Queue getQueue() {
return queue;
}
public void setQueue(Queue queue) {
this.queue = queue;
}
public Template getTemplate() {
return template;
}
public void setTemplate(Template template) {
this.template = template;
}
}
When I try to execute this query
Code:
session.createQuery("select template from TemplateQueue where queue is null").list();
I get an exception
Code:
...
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
...
Caused by: org.postgresql.util.PSQLException: ERROR: column "queue" does not exist
...
Is it normal behaviour? Should I care about column name using HQL queries.
Hibernate version:
<dependency org="org.hibernate" name="hibernate-core" rev="3.5.0-Final"/>
<dependency org="org.hibernate" name="hibernate-annotations" rev="3.5.0-Final"/>
<dependency org="org.hibernate" name="hibernate-commons-annotations" rev="3.2.0.Final"/>
<dependency org="org.hibernate" name="hibernate-validator" rev="4.0.2.GA"/>
<dependency org="org.hibernate.javax.persistence" name="hibernate-jpa-2.0-api" rev="1.0.0.Final"/>