fly2moon2 wrote:
Document class is self-referencing; it has a set named parentDocs (i.e. parent documents) and set to lazy. The value of parentDocs is saved in a table named DocInDocuments.
I received error (no session to fetch lazy collection) on running the following line of code simply adding a parent document (docParent) to the parentDocs collection of the child document (doc):
doc.parentDocs.Add(docParent);
So, is the session present for fetching? In case of set, the content of collection must be fetched before adding an element, cause the set may not contain duplicates.
Read 14.1.2 and 14.1.3 (and probably all others :D) from
http://www.hibernate.org/hib_docs/nhibernate/html/performance.html#performance-collections
Gert