-->
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.  [ 5 posts ] 
Author Message
 Post subject: Why does Overridable is recommended?
PostPosted: Wed Mar 12, 2008 1:12 pm 
Newbie

Joined: Mon Feb 04, 2008 7:24 pm
Posts: 6
Hi.

I read some articles stating that is necessary to sign the class properties as Overridable (virtual in C# if I am not wrong). But why? What kind of problems could I find if I do not follow this rule?

Regards,
rferj


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 12, 2008 1:14 pm 
Regular
Regular

Joined: Wed Aug 15, 2007 7:37 am
Posts: 73
Proxying (lazy loading) doesn't work, because Hibernate can't subclass your class with a proxy. They don't need to be virtual if you always specify lazy="false" or set the default to be false.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 13, 2008 11:01 am 
Newbie

Joined: Mon Feb 04, 2008 7:24 pm
Posts: 6
Hi Steve.

Is it true for my methods also, or just the properties need to be signed as Overridable?

TIA,
rferj


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 13, 2008 11:11 am 
Regular
Regular

Joined: Wed Aug 15, 2007 7:37 am
Posts: 73
Just any properties you map with NHibernate. If you don't want lazy loading you don't have to do it at all - just specify lazy="false" in the class attributes.

Steve


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 13, 2008 12:04 pm 
Beginner
Beginner

Joined: Fri Aug 10, 2007 3:34 am
Posts: 44
you can avoid using <<virtual>> by creating an interface to the class.
creating interfaces to classes is one of the OO programming principles:
Program to an interface not to an implementation


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