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?
SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
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.