由于某些原因,hibernate生成的查询是错误的。我还有其他表/类,其中生成的查询是正确的,但是对于一个表,它是错误的。当我使用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
表或我的Java类中不存在列att_id_1、att_id_2、att_id_3和att_id_4!我该如何解决这个问题?这一切为什么要发生?
发布于 2015-06-14 21:21:53
事实证明,这只是一个简单的错误。我继续在这个项目上工作,我看到的下一个类匹配了我在问题中得到的查询,所以我检查了代码,发现我在代码中引用了错误的类!
https://stackoverflow.com/questions/30829682
复制相似问题