简体   繁体   English

nhibernate中出现错误“ not a association id”

[英]Error “not an association id” in nhibernate

I got the following error message from nhibernate: 我从nhibernate收到以下错误消息:

{"not an association: ID"} {“不是关联:ID”}

Model.Order orderAlias = null;
Model.Unit unitAlias = null;

query to reproduce: 查询重现:

var query = m_hibernateSession.QueryOver<Model.Order>(() => orderAlias)
                    .JoinAlias(() => orderAlias.ID, () => unitAlias, JoinType.InnerJoin)
                    .TransformUsing(Transformers.DistinctRootEntity)
                    .OrderBy(x => x.PONumber).Desc.Take(5);

(for DB model look also here: nhibernate criteria for selecting from different tables ) (对于数据库模型,请在此处查看: 从不同表中进行选择的休眠标准

What does this mean and how can I correctly retrieve my result list? 这是什么意思,如何正确检索结果列表?

Thx 谢谢

In Model.Order class, ID should be of type Model.Unit. 在Model.Order类中,ID的类型应为Model.Unit。

Make sure you have classes for both Model.Order and Model.Unit 确保您同时具有Model.Order和Model.Unit的类

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

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