The question solved.Thank you.
I finally altered to the hbm document like this
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="NHibernateStudy.DTO" assembly="NHibernateStudy">
<class name="Tag" table="Tag" >
<id name="TagID" column="TagID" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
<property name="TagName" column="TagName" />
<many-to-one name="ParentTag" class="Tag" column="ParentTagID" not-null="true" />
<set name="ChildTag" inverse="true">
<key column="ParentTagID" />
<one-to-many class="Tag" />
</set>
<set name="ChildProduct">
<key column="BelongTagID" />
<one-to-many class="Product,NHibernateStudy" />
</set>
</class>
</hibernate-mapping>
I think I will be able to attempt use NHibernate.Mapping.Attributes later.
thank you KPixel.
But now had the new problem again.
I am unable to carry on any inquiry on 'Tag', any inquiry all does not have the result.
Quote:
No row with the given identifier exists: 0,
I use ISession.Load method
Causes this question the reason is
Code:
<many-to-one name="ParentTag" class="Tag" column="ParentTagID" not-null="true" />
<set name="ChildTag" inverse="true">
<key column="ParentTagID" />
<one-to-many class="Tag" />
</set>
becase i see the LOG , Inside has such one part
Quote:
SELECT tag0_.TagID as TagID1_, tag0_.TagName as TagName1_, tag0_.ParentTagID as ParentTa3_1_, tag1_.TagID as TagID0_, tag1_.TagName as TagName0_, tag1_.ParentTagID as ParentTa3_0_ FROM Tag tag0_ left outer join Tag tag1_ on tag0_.ParentTagID=tag1_.TagID WHERE tag0_.TagID=@p0
my Table structure is
TagID
TagName
ParentTagID
I am thinking that Nhibernate do not support this kind of structure???????
How realizes one tree's classics method is? Thanks.