title: Java HQL org.hsqldb.HsqlException: user lacks privilege or object not found
body: <p>I am using Spring 3 with Hibernate 3. I am using the DAO design pattern and using HQL to query the database. However, when searching for data that does not exist for a field I get the following Exception:</p>
  
  <pre><code>org.hsqldb.HsqlException: user lacks privilege or object not found: ADDRESS2
  </code></pre>
  
  <p>I am using Liquidbase to manage the database XML schema that creates the tables. Below is the sample code:</p>
  
  <pre><code>@Entity
  @Table(name = "message")
  public class Message() {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private int id;
      @Column(length = 100, nullable = false)
      private String address;
  
      public Message() {
  
      }
  
      // getters and setters
  }
  </code></pre>
  
  <p>The following HQL is used from the DAO:</p>
  
  <pre><code> getHibernateTemplate().find("FROM Message m WHERE m.address = address2");
  </code></pre>
  
  <p>The following properties are being set:</p>
  
  <pre><code>jdbc.driverClassName=org.hsqldb.jdbc.JDBCDriver
  jdbc.url=jdbc:hsqldb:mem:testdb'shutdown=true
  jdbc.username=sa
  jdbc.password=
  hibernate.dialect=org.hibernate.dialect.HSQLDialect
  hibernate.show_sql=true
  hibernate.hbm2ddl.auto=validate
  </code></pre>
  
  <p>I cannot find a solution. I can successfully insert a record and also use the same HQL query to find objects with actual values that have been saved, but the problem is with finding values that don't exist.</p>