-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Comparing types for proxy and Domain class
PostPosted: Fri Sep 26, 2008 10:08 am 
Regular
Regular

Joined: Thu Nov 30, 2006 10:48 am
Posts: 59
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.