It seems to be a feature request:session.Load<TMappedClass, TProxy>(object
id)

2009/10/12 Skafa <[email protected]>

>
> And, ofcourse, you should do the casting yourself:
>
> var skill = (ISkill) session.Load(typeof(Skill), id);
>
> On 30 sep, 07:16, Richard Dingwall <[email protected]> wrote:
> > I have the following class and mapping:
> >
> > public interface ISkill : IObjectWithId<int> {...}
> > public class Skill : ISkill, ObjectWithId<int>, IEquatable<Skill>
> > {...}
> >
> > <class name="Skill" table="Skill"proxy="ISkill">...</class>
> >
> > Skill has a few collections but no subclasses.
> >
> > Fetching skills via Session.Get<T>() works great, but callingLoad()
> > always throws an internal NH exception:
> >
> > ISkill skill = Session.Load<Skill>(42);
> >
> > System.InvalidCastException : Unable to cast object of type
> > 'INHibernateProxyProxy' to type 'Abc.DomainModel.Xyz.Skill'.
> > at NHibernate.Impl.SessionImpl.Load[T](Object id)
> >
> > It's maybe (probably) something really dumb I am doing, but is this
> > not a massive flaw?
> >
> > Why bother having a generic version ofLoad() if it doesn't support
> > lazy loading, its primary use case? Could we get a more useful error
> > message at least?
> >
> > Using NH 2.1.0.GA. I tried with LinFu, Spring and Castle and all
> > implementations had the same result.
> >
> > The other alternative, specifying theproxydoesn't work either,
> > because it is aproxynot a mapped class and NH doesn't recognize
> > querying by proxies.
> >
> > ISkill skill = Session.Load<ISkill>(42); // cannot resolve unmapped
> > class 'ISkill'
> >
> > Someone please explain where I am going wrong here!
> >
> > Rich
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
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