title: Unknown column username in 'where clause'
body: <p>I got this error when I try to select on table that one of its column is foreign key:</p>
  
  <pre><code>select count(*) from cards where username = 'name';
  </code></pre>
  
  <p>I am doing it through java jdbc so I think something with my mapping is wrong because the same query on through MySql commandline works just fine:</p>
  
  <pre><code>&lt;many-to-one name="users" class="table" update="false" insert="false" fetch="select"&gt;
          &lt;column name="username" length="45" not-null="true" /&gt;
  &lt;/many-to-one&gt;
  </code></pre>
  
  <p>The </p>
  
  <pre><code>2013-03-02 12:19:03,660  INFO [http-bio-8080-exec-5] (NullableType.java:203) - could not read column value from result set: username; Column 'username' not found.
  2013-03-02 12:19:03,663  WARN [http-bio-8080-exec-5] (JDBCExceptionReporter.java:100) - SQL Error: 0, SQLState: S0022
  2013-03-02 12:19:03,664 ERROR [http-bio-8080-exec-5] (JDBCExceptionReporter.java:101) - Column 'username' not found.
  </code></pre>
  
  <hr>
  
  <p>I fount this:</p>
  
  <p><a href="http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querysql.html#d0e13696" rel="nofollow">http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querysql.html#d0e13696</a></p>
  
  <p>sections 16.1.2 and 16.1.3 probably the answer for my issue but I cant figure it out...</p>