This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When to use Java Beans and when EJB

 
Java Ci
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello alltogether,
when i start developing an application based on an application server e.g. tomcat, when do i decide to use EJBs and when can i use Java Beans?
How much more effort will it be to develop EJBs in compare to Java Beans.
I think of following architecture:
M: JSPs
V: JavaBeans / Servlets
C: Java Beans / EJBs
When to choose what?
Thanks for Help
Ci
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I think you wanted the Web Developer Exam forum for this question.
But you use a JavaBean for simple stuff, that doesn't need the overhead of an Application server.
But you use an EJB, when you really want to use the benefits of an App Server, like Transactions, JDBC, Security, and just well optimized Server for that stuff.
Mark
 
Greg Georges
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like Mark mentionned, Javabeans and EJBs are a whole different ballgame. You will rarely use EJBs if you DO NOT need a huge system which needs transaction support, bean pooling, increased security etc. Javabeans are only serialized objects which have accessor methods (getters and setters).
If you are thinking in small terms (ex: website which does not need loads of concurrent users), go with an MVC model with JSP, servlets and JDBC.
If you need an enterprise application with thousands of users, security, transaction management, etc..), use EJBs (however use them wisely, read Core J2EE design patterns for the best practices), get a good application server (weblogic and websphere are both excellent, cannot forget JBoss either), and give yourself time because there is a large enough learning curve for EJB (version 2.0 now includes message driven beans, larger deployment descriptors, etc). Hope this gives you a little more insight
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic