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):

  1. bean has @localbean annotation -> bean has no-interface view
  2. bean has @local annotation -> bean has local view
  3. bean has @remote annotation -> bean has remote view
  4. bean has no view annotations, directly implements interface has @local annotation -> bean has local view
  5. bean has no view annotations, directly implements interface has @remote annotation -> bean has remote view
  6. bean has no view annotations, directly implements interface has no view annotations -> bean has local view
  7. 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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -