Has anyone encountered this problem, and do you have a solution?
Code:
Thanks.
I am using NHibernate.Mapping.Attributes to decorate my classes, then I open the config, yada yada yada, and I am able to issue a session.Load command successfully. HOWEVER, when I add another class with just one property (and id), I get an error:
Quote:
The element 'id' in namespace 'urn:nhibernate-mapping-2.0' has incomplete content. List of possible elements expected: 'urn:nhibernate-mapping-2.0:meta urn:nhibernate-mapping-2.0:column urn:nhibernate-mapping-2.0:generator'.
here is how I read the attributes:Code:
using (MemoryStream stream = new MemoryStream())
{
serializer.Serialize(stream, System.Reflection.Assembly.GetExecutingAssembly());
stream.Position = 0;
config.AddInputStream(stream);
}
factory = config.BuildSessionFactory();
Here is the content of stream:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--Generated from NHibernate.Mapping.Attributes on 2006-04-11 10:03:40Z.-->
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="HomeSpace.Resource, NHibernateTest2" table="RESOURCE">
<id column="ResourceId" type="System.Guid">
<generator class="native" />
</id>
<property name="LoginID" column="NTLoginID" />
<property name="EmployeeNo" column="EMPLOYEE" />
</class>
<class name="HomeSpace.EMPLOYER, NHibernateTest2" table="EMPLOYER">
<id column="EMPLOYER_ID" type="Int32" />
</class>
</hibernate-mapping>
I then noticed that the id of EMPLOYER_ID column does not have a
Code:
<generator>
, so I added it manullay by saving the content of the stream to an xml file, editing it, then using
Code:
config.AddXmlFile("c:\\config.xml");
instead of a memory stream.
I get the same problem!!!