I am using a stateless EJB (EJB3).
Clients are working with this EJB (version A of the EJB).
Now I have new clients with more requirements for the EJB.
Therefore I have to modify or add new methods to the EJB (version B of the EJB).
However, version A of the EJB still needs to be available and deployt (in the same container) for the older clients.
What is the best way for versioning EJBs?
I don't want to change the package name of the EJB since it really should stay the same, only the implemention/methods alter.
My best guess is to leave the full qualified name stable e.g. com.store.shopping.Cart but modify the JNDI name such as com.store.shopping.Cart_A and com.store.shopping.Cart_B. The clients would then make a lookup to the appropriate JNDI name.
This however brings up the questions if the same full qualified name can be deployt twice (in two different EARs within the same container) but only with different JNDI names.
One approach is to use the same EJB and just different methods. If you can manage this right, you don't even have to change the methods. (Methods taking just a data transfer object can add fields to the object while remaining backward compatible.)