简体   繁体   English

休眠-列名att_id_1无效

[英]Hibernate - The column name att_id_1 is not valid

For some reason the query that is generated by hibernate is wrong. 由于某种原因,休眠生成的查询是错误的。 I have other tables/classes where the generated query is correct however for one table it is wrong. 我还有其他表/类,其中生成的查询是正确的,但是对于一个表却是错误的。 When I do a trace using MS Management Studio I see the following: 当我使用MS Management Studio进行跟踪时,会看到以下内容:

exec sp_prepexec @p1 output,NULL,N'select aprresourc0_.agrtid as agrtid1_14_, aprresourc0_.att_id_1 as att_id_2_14_, 
aprresourc0_.att_id_2 as att_id_3_14_, aprresourc0_.att_id_3 as att_id_4_14_, aprresourc0_.att_id_4 as att_id_5_14_, 
aprresourc0_.attribute_id as attribut6_14_, aprresourc0_.bflag as bflag7_14_, aprresourc0_.client as client8_14_, ... 
from aprresourcepost aprresourc0_ 
where ...
select @p1

The columns att_id_1, att_id_2, att_id_3 and att_id_4 do not exist in the table or my Java class! 表或Java类中不存在列att_id_1,att_id_2,att_id_3和att_id_4! How do I fix this? 我该如何解决? Why does this happen? 为什么会这样?

It turns out to have been a simple mistake. 事实证明这是一个简单的错误。 I continued to work on the project and the next class I was looking at matched the query I was getting in my problem so I checked the code and found I was referencing the wrong class in my code! 我继续从事该项目,正在查看的下一个类与遇到问题的查询匹配,因此我检查了代码,发现我在代码中引用了错误的类!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM