Summary
In a recent JavaWorld article, Shashank Tiwari looks at migration strategies for an EJB 2.x application to the latest EJB standard.
Advertisement
While the EJB 3.0 specifications went to great lengths to preserve backwards compatibility with previous EJB versions, the only way for an existing J2EE app to benefit from EJB 3.0's advances is by upgrade to the latest standard.
In a recent JavaWorld article, Migrating EJB 2.x applications to EJB 3.0, Shashank Tiwari points out that such a migration should be painless for most EJB 2.x applications:
The EJB 3.0 ... expert group specifically identified easy migration as an objective and hence provided for both backward compatibility and interoperability between enterprise bean components written in the old and the new specifications. This also makes it possible for EJB 2.x and earlier beans to be gradually and incrementally modified to utilize the EJB 3.0 specification.
The desire to be backwards compatible has also been mentioned in the Artima interview with EJB 3.0 spec lead Linda DeMichiel, Refactoring the EJB APIs, Part I and Part II.
In the JavaWorld article, Tiwari also points out that migration may become more complicated as the EJB spec evolves:
With the current emphasis on backward compatibility and ease of migration, now may be the best time to move EJB applications to EJB 3.0. As the EJB specification continues to evolve, moving legacy EJB code ... to the newer specifications may grow more difficult.
The first part of the article outlines differences between in the 2.x and 3.0 specifications in key areas, such as the bean interfaces and lifecycle methods. Tiwari then suggests simple steps for incrementally migrating an application, temporarily combining components in the spec versions, such as:
Enabling new functionality in EJB 3.0 with existing code in the old specification
Using EJB 2.x and earlier clients of EJB 3.0 components
Using EJB 3.0 clients of EJB 2.x components
He then focuses on migrating EJB 2.1 session beans and entity beans to EJB 3.0, pointing out that some migration tasks can be automated with tools, some of which are available via IDEs.
In what situations do you think you'll get the most payoff from migrating an EJB 2.x app to EJB 3.0?