I am relatively new to using Nhibernate but basic things already are working.
Now I have to map the generic entity that implements the tree structure. Separately, each one (only generic or only tree) works fine.
Here’s the code for the model:
public class Test<T>
{
public virtual Int64 Id { get; set; }
public string Name { get; set; }
public IList<Test<T>> Children { get; set; }
}
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="PersistencyObjectModel" namespace="PersistencyObjectModel.Domain">
<class name="Test`1[String]">
<id name="Id">
<generator class="guid"/>
</id>
<property name="Name" length="50" not-null="true" unique="true"/>
<set name="Children" table="TEST_TEST_LINK" cascade="all-delete-orphan" >
<key column="ParentId"/>
<many-to-many column="ChildId" class="Test`1[String]"/>
</set>
</class>
</hibernate-mapping>
When I use that model, I get the following Nhibernate error:
{"persistent class PersistencyObjectModel.Domain.Test`1[[PersistencyObjectModel.Domain.String,
PersistencyObjectModel]], PersistencyObjectModel not found"}
What does this error mean and how can I fix it?
Update: try this
Some things to note:
guidgenerator with alongpropery; change that toGuid