Thats weird because a lazy bag doesn't get initialized by simply
calling an add().  Can you show us your code?

On Jul 31, 6:01 am, Adeel <[email protected]> wrote:
> Anyone...?
>
> On 30 jul, 23:24, Adeel <[email protected]> wrote:
>
> > Hi All,
>
> > My webapplication consists of memberprofiles which may or may not have
> > favorites. These favorites are profiles of other members. In the
> > database this realtion consists of two tables, one holding the data
> > for the profiles and one tables holding the ID's of the owner of the
> > favorite and the ID of the profile of the favorite itself.
> > The mapping is as follows:
>
> >     <bag name="_favoritesCollection" access="field"
> > table="Tbl_Favoriet" lazy="true" >
> >       <cache usage="read-write"/>
> >       <key column="Person_IDFK"/>
> >       <many-to-many class="Member" column="Favoriet_Person_IDFK"/>
> >     </bag>
>
> > So far so good. The problem arises when a Member tries to add a
> > favorite, and only he of she does not have a favorite in his or her
> > collection beforehand. In this case I get the dreaded
> > NHibernate.LazyInitializationException: illegal access to loading
> > collection message.
> > I know this is because the collection is lazily initialized and it
> > should be possible to solve this problem by initilizing the collection
> > when retrieving the member object from the database. But this does not
> > seem to work.
>
> > By the way I am using Rhino.Commons 2.0 and Nhibernate 2.1.0.1001. (it
> > says so in Visual Studio).
>
> > Any suggestions please...!!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to