Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Perils and Merits of EJB  RSS feed

 
Siegfried Heintze
Ranch Hand
Posts: 417
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone give me a good reference that discusses the perils and merits of EJB?
Here are the merits of EJB that I am aware of:
(1) Performance (anybody have some benchmarks? David Chapell in his recent talk at Softpro Books in South Denver said the Sun PetStore example could be implemeneted much more efficiently without EJB).
(2) CMP (container managed persistance) is very nice -- but is anyone using it?
(3) BMP (bean managed persistance) -- what is the merit to this approach? Why not just use JDBC?
(4) Role based security is implemented for session and entity beans.
What are the disadvantages?
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, here's my 2 cents...
(1) Performance is one of those issues that keeps cropping up again and again. Some camps say that EJB provides fantastic performance, while some don't. The reasons against are because EJBs are relatively heavyweight, container managed components that require a fair amount of resources. On the other hand, containers (depending on which vendor you choose) can optimize things by pooling bean instances, providing caching for entity beans and so on. So then, is performance a merit of EJBs? I think so. Scalability is also one of the best things about the stateless session bean model.
(2 and 3) Despite what people say, CMP makes building entity beans very, very easy. BMP is great, and IMHO, a better way to build truly portable entity beans - simply because you don't have to rewrite the deployment descriptors for each server. On the projects that I've been involved in, we've usually used a combination of CMP (for the straightfoward O/R mappings) and BMPs (for more complex stuff). In addition to this, we also use patterns like Data Access Object and Value Object next to entity beans when we need to read large amounts of persistent information. This hybrid approach means that we get high performance reads, while still maintaining the nice abstraction layer for small reads and updates.
(4) Role based security is great, although since the majority of systems will have a web-based interface built using JSPs and Servlets, you may find that you never actually need to use it, but rather handle this in the web tier. Even so, having the ability to control who accesses beans and their methods is a very powerful feature.
Anybody else have any thoughts?
Simon
 
Rick Hightower
Author
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes! People are using EJB.
EJB is getting more useful.
Check out this posting...
EJB is useful and getting even more so!
Re:
"CMP (container managed persistance) is very nice -- but is anyone using it?"
CMP/CMR and EJB QL are very productive.
Check out this 4 part tutorial that is on developerWorks. Here is a site that explains the 4 part series....

4 part series on EJB 2.0 CMP/CMR and EJB QL
[ June 27, 2002: Message edited by: Rick Hightower ]
 
Tim Holloway
Bartender
Posts: 18713
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are something like 5 things that EJBs offer (depending on how well my memory is working!)
1. Remote Invocation
2. Single-threaded interface
3. Transaction Management
4. Caching
5. Clusterability
My general rule is if I need at least 3 of them, use an EJB - the advantages of a predebugged system outweigh the expenses. If not, go for something lighter weight.
Choices are good!
 
Siegfried Heintze
Ranch Hand
Posts: 417
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>
> There are something like 5 things that EJBs offer (depending on how well my memory is working!)
> 1. Remote Invocation
Is EJB better than RMI or SOAP?
Is this a non-issue for web-applications?
> 2. Single-threaded interface
If I have a web server like Tomcat calling my bean thru JSP, will I get a single threaded interface that is just as effective?

> 3. Transaction Management
Yup!
> 4. Caching
Is this exclusively and specifically a performance issue?
> 5. Clusterability
What does this mean? Does it mean that I can have two network nodes/CPUs sharing a drive and if one goes down the app continues to run on the other CPU?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!