• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

How do you know when to use EJBs?

 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: this thread was restarted here in the EJB forum because it was drifting way off-topic in the Mac OS X forum:

old thread

...I tend to run screaming from anything Sun endorsed (EJB...



What would you use instead of EJBs? Spring?



I've been writing enterprise-level web apps from over 7 years and never used EJBs. Or Spring. Or any of the other large Rube Goldberg frameworks.



So, do you use Servlets & JSPs without EJBs and without Spring? What do you use? JDBC? I could deal with that.

When, if ever, would you use EBJs? I've read that EJBs are like the space-shuttle, they have their place but you wouldn't use them in every-day life to go to the store and buy a loaf of bread.

Kaydell
[ July 24, 2007: Message edited by: Kaydell Leavitt ]
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This could easily tune into a discussion of framework/approach A vs. framework/approach B, so I'll address the question on a higher, somewhat more generic level.

Using servlets directly has fallen a bit out of fashion, at least for the task of accepting web requests, performing some validation, then executing associated business logic, and finally dispatching to a JSP page (or similar template mechanism). Generally a web framework would be used for that. Some of the popular ones are Struts, Shale (kind of Struts 2), JSF, Spring (which also does other stuff), with libaries like Wicket and Stripes somewhat less widely used. Velocity is a contender for JSP's role.

I'm sure I've left out someone's favorite approach, but the important point is that there are a number of ways to do this (and all these frameworks address slightly different parts of the complete picture), so it pays to look into a few of them to decide what might make sense for a given project.

Something similar is true for database access. Raw JDBC is becoming unfashionable for many tasks, and various object-relational mapping tools have stepped up to plate. Hibernate is the most popular, and worth looking into, but it's not uncommon to read about people rolling their classes that encapsulate access to DB tables. EJB has had it shares of problems (not the least that it requires an EJB container, so it can't be used in something like Tomcat), but EJB 3 has a much simplified development/deployment model, so that may change in the future. It's also much close to the latest version of Hibernate 3 now.
 
expectation is the root of all heartache - shakespeare. tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!