• Post Reply Bookmark Topic Watch Topic
  • New Topic

Differences between @javax.ejb.LocalBean and @javax.ejb.Local  RSS feed

 
Jeane Lindford
Greenhorn
Posts: 17
Flex Java Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
what's the difference between @javax.ejb.LocalBean and @javax.ejb.Local?
I'm new to EJB 3.1 and I always used the @javax.ejb.Local
when should I use this new annotation?
thanks
 
kurt hanni
Ranch Hand
Posts: 140
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use @LocalBean when the session bean has no local view / interface




Use @Local when you are using a local view / interface
(you can annotate the interface or the class)


 
Jeane Lindford
Greenhorn
Posts: 17
Flex Java Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
o man this is so good
i hate to develop a lot of interfaces
why is a good practice to have one interface for all ejbs?
using only @javax.ejb.LocalBean sounds as a good and fast way to develop ejbs
thanks a lot and sorry my newbiness
 
kurt hanni
Ranch Hand
Posts: 140
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In ejb 3.0 it is spec defined to have at least one interface per session bean, this has something to do with bean proxies

There are lots of pros in practicing "coding to interfaces", loose coupling, mocks, class template, etc.
I would prefer to use the implentation class directlty, unless I really need an interface.

remember no-interface-beans will only work on local beans, so if your using remote beans (app is distributed) you still need to write a remote interface
 
Jeane Lindford
Greenhorn
Posts: 17
Flex Java Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot kurt
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!