These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: XmlIgnoreAttribute, NHibernate.LazyInitializationException
PostPosted: Mon Jul 10, 2006 8:16 am 
Newbie

Joined: Wed Jun 15, 2005 9:18 am
Posts: 11
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.