I have some basic questions on EJBs (in the light of EE 7).
Here is a class hierarchy:
public class Class1 {};
public class Class2 extends Class1 {};
public class Class3 extends Class1 {};
public class Class4 extends Class3 {};
I would like to make an EJB out of Class4. So,
You can simply turn Class4
into an EJB. Just annotate it with @Stateless
to make a stateless EJB, and with @LocalBean
if you want to expose its methods without declaring an interface.
It does not matter if Class1
is absract or concrete.
If you turn Class1
into an EJB, it will have no impact on its inherited classes. But Class1
must not be abstract in this case.
Err...yes...?
Yes
You may use JMS in the case where some EJBs are Message Driven Beans. But if your EJBs are SLSB of SFSB, they will communicate through plain java calls on the same container, or using RMI if they are not on the same container. CDI can be used to obtain instances of EJBs (@Inject
), because EJBs are CDI beans. But you can also use basic DI to to that (@EJB
)