Is there a standard way to get around the problem where we need to get the actual domain class type instead of the proxy class type? E.g. for a lazily-loaded M-1 or 1-1 relationship, a proxy class will be generated. If I then expect that type to be the domain type that it extends, it won't work.
e.g. We have a domain object hierarchy with ManagedElement at the top; a ManagedElement can be a Unit, a Node, a Device, an Interface, etc. Furthermore, there's an indeterminate nesting of managed elements where a Unit can have other Units in it (and so on) and Nodes which have Devices which have Interfaces, etc.
ManagedElement me = ... // get managed element & get its parentElement lazily
if (me.Parent.getType().Name.Equals("Unit")) <-- doesn't work
I don't know if I can resolve the problem w/in nHib b/c the indeterminate nesting means that it can't eagerly fetch which means I'm left with a proxy somewhere along the ancestor hierarchy.
I've resolved the problem by going outside of nHibernate and using a recursive CTE query (at this point, we're not using nested sets but, instead, a simple foreign key to the parent in a generic ManagedElement db table for a table-per-class-hierarchy implementation of inheritance).
Just wondering what others have done ...
Thanks,
Bill
_________________ metazone
|