当我尝试在表上选择其中一列是外键时出现此错误:
select count(*) from cards where username = 'name';
我是通过 java jdbc 做的,所以我认为我的映射有问题,因为通过 MySql 命令行的相同查询工作得很好:
<many-to-one name="users" class="table" update="false" insert="false" fetch="select">
<column name="username" length="45" not-null="true" />
</many-to-one>
这
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.
我发现了这个:
http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querysql.html#d0e13696
第 16.1.2 和 16.1.3 节可能是我问题的答案,但我无法弄清楚......