-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HQL query condition wrong column resolution
PostPosted: Mon Jun 07, 2010 6:41 am 
Newbie

Joined: Fri May 07, 2010 7:44 am
Posts: 1
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"/>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.