Hi,
This may be a noobie question, but I couldn't google up any reasonable
answer so here I go:
I have classes Race and Contestant with two-directional one-to-many
I get a "NHibernate.LazyInitializationException: illegal access to
loading collection"
when I load Races from the DB
any idea why?
public class Contestant
{
private Guid Id { get; set; }
private Race _race;
public virtual Race Race
{
get { return this._race; }
set
{
this._race = value;
this._race.Contestants.Add( this ); //<-- Exception
goes in this line
}
}
}
here's the relevant part of the mapping:
<bag name="Contestants" cascade="save-update" inverse="true"
lazy="false" fetch="subselect" batch-size="20">
<key column="Race"/>
<one-to-many class="Contestant"/>
</bag>
Thanks,
Krzysztof
CONFIDENTIALITY NOTICE
This message is intended exclusively for the individual or entity to which it
is addressed. This communication may contain information that is proprietary,
privileged, confidential or otherwise legally exempt from disclosure. If you
are not the named addressee, you are not authorized to read, print, retain,
copy or disseminate this message or any part of it. If you have received this
message in error, please delete all copies of this message and notify the
sender immediately by return mail or fax ATSI S.A.(+4812) 285 36 04.
Any email attachment may contain software viruses which could damage your own
computer system. Whilst reasonable precaution has been taken to minimise this
risk, we cannot accept liability for any damage which you sustain as a result
of software viruses. You should therefore carry out your own virus checks
before opening any attachments.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---