开发者

nHibernate: Using entity-name with QueryOver and CreateCriteria

I have two hbm.xml mappingfiles. They are identical except for the class table and class entity-name properties. They are supposed to populate the same Entity. They have entity-name= Alpha and Beta, table= PersonAlpha and PersonBeta respectively.

I have tryed using both QueryOver and Criteria to populate the entity Person:

var person = session.QueryOver<Person>("Alpha").Where(p => p.Firstname == "Donald").SingleOrDefault<Person>();
var person2 = session.CreateCriteria("Beta").Add(Restrictions.Eq("Firstname", "Donald")).UniqueResult<Person>();

As Im ref to the entity-name I thought nHibernate would know which mappingfile to use, but according to Profiler each of the above statements gene开发者_如何学编程rete SQLs against both the PersonAlpha and PersonBeta tables. Why is this?

Im using version 3.2.0 2001 og nHibernate.

Thanks!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜