NHibernate version:
1.0.1
Mapping documents:
<bag name="Product" table="LINK_PRODUCT_CATEGORY" lazy="true" >
<key column="ID_CATEGORY"/>
<many-to-many class="Product" column="ID_PRODUCT" />
</bag>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
NHibernate.LazyInitializationException::.ctor (0) | Failed to lazily initialize a collection - no session
NHibernate.LazyInitializationException: Failed to lazily initialize a collection - no session
Name and version of the database you are using:
Sql Server 2005
The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
N/A
Hello,
I have a lazy many-to-many association between 2 objects (let's say 'Category' and 'Product'). When I expose the Category object through a webservice I do not want the products collection (IList) to be exposed so I added [System.Xml.Serialization.XmlIgnoreAttribute()] on the property.
Now I have the following exception "Hibernate.LazyInitializationException: Failed to lazily initialize a collection".
Is there a way to solve this issue ?
Thanks,
Gengis
|