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: Manual Lazy load without dynamic proxy
PostPosted: Mon Sep 24, 2007 4:33 pm 
Newbie

Joined: Mon Sep 24, 2007 4:22 pm
Posts: 6
Location: Ukraine, Kharkiv
How can I disable child collection loading?
I want to do nex thing:
Code:
<set name="Names" table="NAMES" DoNotUseLazyAndDoNotLoadThisCollection="true">
   <key column="group_id" />
   <element column="NAME" type="String" />
</set>


because lazy loading is not supported in medium trust level

And then write the following method

Code:
public IList Names
{
     get {
         if (names == null) {
             names = LoadPropertyManually("Names");
         }
         return names;
     }
}


The main advantage of "DoNotUseLazyAndDoNotLoadThisCollection" is that I will be able to use Names collection in HQL queries


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 24, 2007 11:37 pm 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
If I were to undertake this I would start looking at the bits that deal with the LazyLoading mechanism such as IProxyFactory or CastleLazyInitializer class and integrate some kind of look up on entities to intercept the lazy loading behaviour.

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 24, 2007 11:40 pm 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
If I were to undertake this I would start looking at the bits that deal with the LazyLoading mechanism such as IProxyFactory or CastleLazyInitializer class and integrate some kind of look up on entities to intercept the lazy loading behaviour.

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 25, 2007 3:19 am 
Newbie

Joined: Mon Sep 24, 2007 4:22 pm
Posts: 6
Location: Ukraine, Kharkiv
I think it is not a solution in my case. Dynamic proxy uses Reflection.Emit, so it can not be used in medium trust level, but CastleLazyInitializer uses DynamicProxy.
I think collection mapping should work like with proxy="false" option, but just does not load collection


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.