The hbm file is:
hbm文件:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="EMSApplication.Domain.Employee, EMSApplication.Domain" table="ems_Employees" proxy="EMSApplication.Domain.IEmployee, EMSApplication.Domain">
<property name="Username">
<column name="Username" length="40" sql-type="nvarchar" not-null="true" index="Username"/>
</property>
<property name="Firstname">
<column name="Firstname" length="40" sql-type="nvarchar" not-null="true" index="Firstname"/>
</property>
</class>
</hibernate-mapping>
The Employee.cs:
Employee.cs:
namespace EMSApplication.Domain {
public class Employee : IEmployee {
private string username;
private string firstname;
public virtual string Firstname {
get {
return firstname;
}
set {
firstname = value;
}
}
public virtual string Username {
get {
return username;
}
set {
username = value;
}
}
}
}
And this is the IEmployee.cs:
这是iemploye。cs:
namespace EMSApplication.Domain {
interface IEmployee {
string Firstname { get; set; }
string Username { get; set; }
}
}
Now I am getting the exception:
现在我得到了一个例外:
The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has invalid child element 'property' in namespace 'urn:nhibernate-mapping-2.2'. List of possible elements expected: 'meta, subselect, cache, synchronize, comment, tuplizer, id, composite-id' in namespace 'urn:nhibernate-mapping-2.2'.
在名称空间“urn: nhibernatemail -2.2”中元素“类”中有无效的子元素“属性”在名称空间“urn: nhibernatemail -2.2”中。可能元素的列表:'meta, subselect, cache,同步,注释,tuplizer, id, composite-id' in namespace 'urn: nhibernatemail -2.2'。
I am using Spring.Net with NHibernate. The invocation of the hbm file is:
我使用Spring。净NHibernate。hbm文件的调用是:
<object id="NHibernateSessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate32">
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingResources">
<list>
<value>assembly://EMSApplication/EMSApplication.Domain/EMSApplication.hbm.xml</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="dialect" value="NHibernate.Dialect.MsSql2008Dialect"/>
<entry key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
<entry key="proxyfactory.factory_class" value="NHibernate.Bytecode.DefaultProxyFactoryFactory, NHibernate"/>
<entry key="show_sql" value="true"/>
<entry key="hbm2ddl.auto" value="update"/>
<entry key="cache.use_query_cache" value="true"/>
</dictionary>
</property>
<property name="ExposeTransactionAwareSessionFactory" value="true" />
</object>
The project structure is:
项目结构是:
Any help will be very helpful.
任何帮助都是很有帮助的。
Thanks.
谢谢。
1 个解决方案
#1
11
You are missing the id
element, which comes before all properties in the schema.
您缺少了id元素,它在模式中的所有属性之前出现。
#1
11
You are missing the id
element, which comes before all properties in the schema.
您缺少了id元素,它在模式中的所有属性之前出现。