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

EJB....What were they thinking??

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am new to EJB. I read about 300 pages so far from HF EJB, and I am getting so annoyed and frustrated.
So far, the EJB designer have broken almost every single fundemental concept in Java.
Here is some:
1) The bean must provide implementation for the compnent interface, but must not implement it.
2) The entitiy bean must provide useless abstract methods for what is called virtual fields.
3) the entitiy bean must provide setter and getters but not the fields themselvies.
4) All the beans types have the same methods with the same signature, however they do totally different things.
5) the ejbCreat() in entity bean must have a return type of the primary key, however it must return null..!!

There are many strange rules that defy the principals of java.
I know every rule is for a reason, however it is invalid argument to break a fundemental principal for your own design.
I found EJB very complex. Maybe I am wrong and talking from no experiece, but I found it very strange that they couldn't come up with a better design and pattern.
Finally, for developers with good working EJB experience, do you think the benefits of EJB is worthwhile? Considering the time one has to put implementing every bean, and the level of complexity in maintaing the code?
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB is worth it if you need the services of the container or you need your business components to be remotely deployed.
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

There are many strange rules that defy the principals of java.

It really depends on your point of view. You are not required to do things that you mention before, NOT BECAUSE THEY ARE NOT NEEDED!!!

Remember, all things are done by the containers. For example, although you have declared the entity's fields via abstract methods, the containers will provide the implementations for all the getters and setters, as well as how to manage those fields. Come think about it, you can definitely implement them in plain old Java, however, when you deploy your codes, it will NOT be platform independent. When you deploy your code in WAS, you need to implement those methods that depends on WAS, same cases for JBoss or WebLogic. Now, you fulfill all the so-called Java rules, however, you will be very painful when you perform platform migration, as each container may have its owm implementation rules!!! That's why you need to declare them as abstract methods, and let the corresponding containers to implement them based on their own rules.

EJB defines these rules because the containers themselves will do all the implementations that fulfill the plain old Java rules. Thus, the final outcome definitely fulfill Java rules. Your coding is just the intermediate outcomes.

Nick
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also it is *very* difficult to write and deploy *scalable and clustered* business objects without the *services* of the *container/J2EE*.
 
Paulo Asterio Nunes
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are all right !

it's so hard .... , that'is the reason for EJB container ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic