aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How to version EJBs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to version EJBs" Watch "How to version EJBs" New topic
Author

How to version EJBs

David Follow
Ranch Hand

Joined: Oct 16, 2001
Posts: 223
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.

SCJP, SCEA
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30938
    
158

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.)


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30938
    
158

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to version EJBs