java - EJB 3.1 @LocalBean vs no annotation -
i understand difference between local view, remote view , no-interface view. don't understand difference between "no view" (no annotation) , no-interface view. , why should annotate interface @local? if don't annotate interface in @ all, there difference?
the rules (from memory):
- bean has
@localbeanannotation -> bean has no-interface view - bean has
@localannotation -> bean has local view - bean has
@remoteannotation -> bean has remote view - bean has no view annotations, directly implements interface has @local annotation -> bean has local view
- bean has no view annotations, directly implements interface has @remote annotation -> bean has remote view
- bean has no view annotations, directly implements interface has no view annotations -> bean has local view
- bean has no view annotations, , implements no interfaces -> bean has no-interface view
so, using @localbean , using no annotation @ both ways of getting no-interface view. if want no-interface view, simplest thing not annotate. provided you're not implementing interfaces.
part of reason @localbean exists add no-interface view bean has interface view. imagine scenario uppermost in spec authors' minds 1 have bean like:
@stateless public class userpreferences { public string getpreference(string preferencename); public map<string, string> getpreferences(); } where want expose both methods locally, coarser-grained getpreferences() remotely. can declaring remote interface method, slapping @localbean on bean class. without it, you'd have write pointless local interface expose both methods locally.
or, @ way, @localbean exists because there such thing no-interface view, , no-annotation option exists handy shortcut.
Comments
Post a Comment