• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to version EJBs

 
David Follow
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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.

Any ideas?
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.

Any better ideas?

TIA.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Follow wrote: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.

They can.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic