it would be helpful if I didn't post before I was done.
Now, I was attempting to load a unique Child given a Parent's Id.
Something like:
var query = Session.CreateQuery("from Child child where
child.Parent.Id=:parentId");
query.SetInt32("parentId", _parentId);
return query.UniqueResult<Child>() as Child;
I ended up getting the "Creating proxy instance failed." error
message.
Is this because there is no way to guarantee uniqueness since I'm not
supplying enough criteria to uniquely select a Child?
Or does it not make sense to instantiate the child side of a many to
many association on its own?
Hopefully this isn't an ignorant question.
Regards,
todd
On Sep 18, 1:55 am, todd brooks <[email protected]> wrote:
> I ran into this issue tonight and I want to make sure I understand
> correctly my error.
>
> Let's say I have a Parent entity and a Child entity. There is a
> ManyToMany association between the two, as a specific Child may have
> more than one Parent.
>
> (snipped for brevity)
> POCO:
> class Parent {
>
> public virtual List<Child> Children { get; protected set; }
>
> }
>
> class Child {
> public virtual Parent Parent { get; set; }
>
> }
>
> In FluentNHibernate this looks like this:
>
> Parent....
> HasManyToMany(parent => parent.Children)
> .Cascade.All()
> .LazyLoad()
> .AsBag();
>
> Child....
> References(child => child.Parent);
>
> Now, I was attempting to get load a unique Child given a Parent's Id.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---