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 calling Load()
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 of Load() 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 the proxy doesn't work either,
because it is a proxy not 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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---