一、Test.Model.Person.hbm.xml(2,2): XML validation error: 未能找到元素“urn:nhibernate-mapping-2.0:hibernate-mapping”的架构信息。 将2.0改为2.2 二、 The following types may not be used as proxies: 类配置文件中Class的Lazy改为false
2.
To change the lazy-initialization proxy setting for a specific class, you can add a "lazy='false'" attribute to the <class> mapping element. This might look something like:
<class
name="NorthwindClasses.Category, NorthwindClasses" table="Categories" lazy ="false" >
3.
To change the lazy-initialization proxy setting for all classes in a given mapping file, you can add a "default-lazy='false'" attribute to the <hibernate-mapping> element, as follows:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
default-lazy
="false">
Unfortunately, Option 3 doesn't really help you much if you do one <class> mapping per <hibernate-mapping> file, a practice which I personally follow and recommend. It's too bad, but there doesn't seem to
be any way to set this default in the <nhibernate> global configuration. But if you do happen to have all of your <class>'s in one .hbm.xml file, "default-lazy" can help you out.
|
Nhibernate 学习笔记(1)
最新推荐文章于 2019-07-04 13:37:46 发布