-->
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.  [ 4 posts ] 
Author Message
 Post subject: Proxy interface sub types
PostPosted: Mon Apr 16, 2007 11:38 am 
Newbie

Joined: Mon Jul 18, 2005 9:04 am
Posts: 11
Hi,

I have been using nHibernate for a while, and follow the development mailing list, but it's my first post here.

I have a problem with proxies, which I was wondering what the "prefered" solution is.
I have a inherence structure like this:
Code:
base
  sub1
    sub1a
  sub2
   sub2a

I have interfaces for each (same inheritence structure), and set the use them for the proxys.
The classes are mapped as "joined sub classes", with a table for each (sub)type

My question is, what is the best way of establishing the type of an object loaded through the proxy? Clearly the:
Code:
obj is sub1

construct isn't going to work as the proxy implements all the interfaces.

Any ideas would be appreciated!

Dries.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 17, 2007 4:06 am 
Newbie

Joined: Mon Jul 18, 2005 9:04 am
Posts: 11
Using nHibernate 1.0.4 and MS SQLserver 2005.
Probably makes no difference though ...


Top
 Profile  
 
 Post subject: Re: Proxy interface sub types
PostPosted: Tue Apr 17, 2007 8:23 am 
Senior
Senior

Joined: Thu Feb 09, 2006 1:30 pm
Posts: 172
driesie wrote:

My question is, what is the best way of establishing the type of an object loaded through the proxy? Clearly the:
Code:
obj is sub1

construct isn't going to work as the proxy implements all the interfaces.

Dries.


Why do you have to use proxies? I would recommend turning off the proxy for these scenarios. Just because the proxy is there as a tool doesn't mean you have to use it for all objects. Use it where it makes sense, and don't use it where it doesn't make sense.

That is basically the approach we took in our application. We have a good number of inheritance trees in our application, and we have had to skip proxies for most of them.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 17, 2007 2:28 pm 
Newbie

Joined: Mon Jul 18, 2005 9:04 am
Posts: 11
We need to proxies for the lazy loading, otherwise in some scenarios (properties through the many-to-one side of the mapping) we end up with loooooads of SQL statements and a huge object graph when we just one a collection of objects and proxy objects on the many-to-one property as we're usually not interested in it.


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

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.