0

我正在使用带有 sql_server 的休眠,但发现以下问题:

select col_code 
from table 
where col_code is null

查询失败:sql error 0, SQLState S1093 The column col_code is not valid

col_code 是一个 char(5),可以从其他数据库浏览器中读取。它只是来自休眠 - 有什么想法吗?

4

1 回答 1

0

I got the same error when I was doing an native SQL query from Java EE/Hibernate. The SQL statement that I passed to persistence was "SELECT Count (1) From Table" and I made the mistake of including a mapping class as a parameter. COUNT(1) returns an integer, so it doesn't need to be mapped. Hope that helps. I would check that you're mapping is right.

于 2015-02-13T20:01:02.007 回答