can a ejb inherit a abstract class?
Sure, the bean implementation class can inherit from almost any class. Assuming a session bean, just make sure that the implementations of all methods in the corresponding remote interface get to that class, either through inheritance or as methods in the derived class itself.
I had problems when i tried to do this due to the return types of the beans.
Then base bean has a return type of one EJB Object and the sub class should have a return type relevant to that bean. But this doesn't work as java doesn't let you change the return type of a function inherited from another class (even if it is a sub class of the orignal return type).
I found that i could get it to compile but when i can to deploy and use the bean it got really confused about which bean i was actually using and i had to cast the bean every time i returned it. (very annoying)
If you come up with a solution please let me know as it would be very useful to be able to do this.
You can't use inheritance with the ejbCreate() methods, but other than that you can. This is where most people miss the boat: ejbCreate methods are used BY THE CONTAINER to instantiate and link up the various remote/local pieces to an implementation of the class.
This same holds doubly true when working with EntityBeans - you can get really messed up trying to use inheritance and the ejbCreate methods there.
All Bean managed methods u can't inherit .. because some of them are Call back methods.