-->
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.  [ 2 posts ] 
Author Message
 Post subject: what is the purpose of the proxy attribute for class mapping
PostPosted: Fri Mar 16, 2007 11:18 am 
Newbie

Joined: Fri Mar 31, 2006 11:18 am
Posts: 5
What is the purpose of the proxy attribute for class mappings? In other words, under what circumstances might you want to specify a different interface for the lazy-load proxy to implement? Also, is it necessary for the interface (specifed for the proxy) to define all mapped properties?

Thanks,
Daniel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 20, 2007 10:49 pm 
Beginner
Beginner

Joined: Sat Dec 10, 2005 6:22 pm
Posts: 28
Location: Chicago, IL
Use a proxy if you do not want to make all methods and properties virtual in your entity class.

Not sure about defining all mapped properties on the Interface, but I would assume so.

I used interfaces for all my proxies and when upgrading to 1.2 I had issues with critieria and proxies. I didn't look into it enough to get around to posting a possible bug, my fix was to ditch the interfaces and make everything virtual on the entity. Worked like a charm from that point on.

One big drawback to interfaces is the inability to load objects with them. I would like to see Session.Get(typeof(IEntity), 100) but of course NHibernate bombs here.

Not much advantage that I can see, almost makes for double work using interfaces. It is probably mostly a carry over from the hibernate port.

Adam


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.